dashwood.net -

Ryan Stefan's Micro Blog

Fix PGP Keys - apt-get update error

Nov 032019

Can't install security updates:

sudo apt-get update && sudo apt-get dist-upgrade

first enter the following command in the terminal

sudo rm /var/lib/apt/lists/* -vf

then update your system by entering the following command in the terminal

sudo apt-get update && sudo apt-get upgrade

after this there should be no errors and everything should work fine.

The key(s) in the keyring /etc/apt/trusted.gpg.d/*** are ignored as the file has an unsupported filetype.

CSGO Config Goodn's

Sep 242019
//Scoreboard and netgraph combined
alias +scores "net_graph 3; +showscores"
alias -scores "net_graph 0; -showscores"
bind tab +scores

cl_radar_scale 0.3
cl_hud_radar_scale 1.15
cl_radar_icon_scale_min 1
cl_radar_always_centered 1
cl_drawhud_force_radar 1
cl_hud_bomb_under_radar 1

//player damage
developer 1
con_filter_enable 2
con_filter_text_out "Player:"
con_filter_text "damage Given"

cl_hud_healthammo_style "1" // show HP and ammo without bars and bullet icons
hud_showtargetid "1" // 1 to enable the red playername target text
cl_forcepreload "1"
mat_queue_mode "2"
r_dynamic "1"
r_drawparticles "0"
r_drawtracers_firstperson "0"

// Jumpthrow
bind mouse1 +attack 
bind mouse2 +attack2
bind "SPACE" "+jump"
alias "+jumpthrow" "+jump;-attack;-attack2"
alias "-jumpthrow" "-jump"
bind "mouse4" "+jumpthrow"

Installing from Github with pipenv - Fix pip on Linux

Jun 222019

Obviously not every pacakge on github is going to be available via pip, but downloading and installing manually clutters up your project directory. That kind of defeats the purpose of using pipenv in the first place. However, installing a package by using the git uri with pipenv is possible just like it is with pip. Here's what you type:

pipenv install -e git+git://github.com/user/project.git#egg=<project>

Pretty simple right? Here's an example of one that I've used recently just in case:

pipenv install -e git+git://github.com/miso-belica/sumy.git#egg=sumy 

Which is the command to install this package: https://github.com/miso-belica/sumy


If you have pipenv command not found use this to fix it:

sudo -H pip install -U pipenv

for scrapy with Python 3, you'll need

sudo apt-get install python3 python-dev python3-dev \
     build-essential libssl-dev libffi-dev \
     libxml2-dev libxslt1-dev zlib1g-dev \

with Python 2, you'll need

sudo apt-get install python-dev  \
     build-essential libssl-dev libffi-dev \
     libxml2-dev libxslt1-dev zlib1g-dev \

Bootleg Sushi Idea

Jun 192019

I had some smoked salmon from Walmart in the fridge and decided to dip it in some wasabi and soy sauce to imitate sashimi. It was pretty tasty and I thought I would put together a bootleg sushi guide here.

I figure using smoked salmon and imitation crab meat with a variety of ingredients will give me a much better understanding of which types of sushi I enjoy the most. I don’t need to make rice every time and I don’t ever need to roll it up if I’m just snacking at home.

My first experiment will be smoke salmon and artificial crab meat paired with cream cheese, sprouts, and avocado.


  • Cucumber
  • Avocado
  • Asparagus
  • Jalapenos
  • green onion
  • carrots
  • sprouts
  • bell peppers
  • pineapple
  • mango
  • apple
  • pear
  • cream cheese
  • tempura [cooked] shrimp
  • imitation crabmeat [cooked]
  • raw sashimi grade salmon
  • smoked salmon
  • raw sashimi grade tuna
  • Black Nori (seaweed wrap)


  • sesame seeds
  • thin slices of fish
  • shrimp or crab salad
  • seaweed salad
  • sliced almonds
  • sprouts
  • thinly sliced avocado
  • volcano topping



Quick Collection of Python CSV Read/Write Techniques

Jun 142019

Import CSV as Dict

  • Creates ordered dict
  • You can increase file size limit
  • Using next() can bypass the header row
import csv

# Dict reader creates an ordered dict (first row will be headers)
with open('./data/file.csv', newline='') as file:
    # Huge csv files might give you a size limit error
    results = csv.DictReader(file, delimiter=';', quotechar='*', quoting=csv.QUOTE_ALL)

    # next() can help in iterations sometimes
    for row in results:
        # prints each item in the column with header 'key'

Import CSV with No Header (nested lists)

  • newline='' prevents blank lines
  • csv.reader uses indexes [0], [1] 
# newline='' prevents blank lines
with open('./data/file.csv', newline='') as file:
    results = csv.reader(file, delimiter=':', quoting=csv.QUOTE_NONE)
    for row in results:
        # csv reader uses indexes

Writing and Creating Headers

  • Create a csv.writer object
  • Create header manually before loop
  • Nested lists are better than tuples inside lists
  • writer.writerow and writer.writerows 
# Creates a csv writer object
writer = csv.writer(
    file, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)

# Write header first if you would like
writer.writerow(['title', 'price', 'shipping'])

''' Tuples inside list (list inside lists are usually better though).
If you're using tuples and they are variable size, note that a single tuple
will convert to string type in a loop so indexing it [0] won't work. '''
products = [['slinky', '$5', 'Free'],
            ['pogo', '$12', '$6'],
            ['Yoyo', '$7', '$2']]

# write each row normal
for item in products:
    writer.writerow(map(str, item))

# Writes all items into a single row
writer.writerow(sum(products, []))

# Writes all 3 rows

Using DictWriter for Headers

  • fieldnames indicates header to object
  • writer.writeheader() writes those fields
# DictWriter field names will add the headers for you when you call writeheader()
with open("./data/file.csv", "w") as file:
    writer = csv.DictWriter(
        file, fieldnames=['title', 'price', 'shipping'],

    writer.writerows([['slinky', '$5', 'Free'],
                      ['pogo', '$12', '$6'],
                      ['Yoyo', '$7', '$2']])

Bonus - Flatten any List

  • Function will flatten any level of nested lists
  • or type == tuple() to catch tuples too
# -- Bonus (Off Topic) --
# You can flatten any list with type checking and recursion
l = [1, 2, [3, 4, [5, 6]], 7, 8, [9, [10]]]
output = []
def flatten_list(l):
    for i in l:
        if type(i) == list:


Python Dict Key Recursive Attempt Function

Jun 132019

So I'm dealing with this huge database where each item has a bunch of levels and some have different keys than others. So I made a script that takes a list of lists and tries those keys, if they work the function breaks. Pretty simple and I'm sure I could make it cleaner, but it works well enough and I don't expect any 4 level items any time soon. Anyways, here's the code:

for item in items:
''' items is a list of dicts to run the keys on '''
results = {} def key_attempter(name, key_lists): nonlocal item nonlocal results for key in key_lists: if len(key) == 1: try: results[name] = item[key[0]] break except: pass elif len(key) == 2: try: results[name] = item[key[0]][key[1]] break except: pass elif len(key) == 3: try: results[name] = item[key[0]][key[1]][key[2]] break except: pass feat_lists = { 'price': [ ['hdpData', 'homeInfo', 'price'], ['price'], ['hdpData', 'priceForHDP'], ['priceLabel'], ['hdpData', 'homeInfo', 'zestimate'], ['hdpData', 'festimate'] ], 'bed': [ ['beds'], ['hdpData', 'homeInfo', 'bedrooms'] ], 'bath': [ ['baths'], ['hdpData', 'homeInfo', 'bathrooms'] ]} for k in feat_lists.keys(): key_attempter(k, feat_lists[k])

return results