Skip to content

Instantly share code, notes, and snippets.

@tswicegood
tswicegood / gist:29a64ba7f3c07cbd5381
Created April 11, 2015 05:39
Talk submission to ONA

Newb's Mind, Expert's Mind

Expertise syndrome is a silent killer of knowledge in information-based industries – whether that’s a news room or a tech shop. Remembering what it was like to use your tools when you didn't know what you didn't know makes it harder for you to communicate with people who are starting out. How do you put yourself in the beginner's mind? Can doing that help you create the next generation of experts in your community? This talk explores those themes and helps you find and implement strategies to share your knowledge in a way that's accessible to everyone, regardless of where they are on their journey.

In A Tweet

Newb's Mind, Expert Mind: How to teach beginners by changing the way you think.

How does your submission contribute to the diversity of the conference?

"Other developers are just like us - weird"

"If you ever need to deploy Django, you're good. If you know Capistrano and Unicorn they've got rip-offs of all that stuff."

"I think we should all admit we're horrible coders and move on" "We're all drug addicts - we're fighting methods..."

"It's easy to learn to play the guitar and be able to play Bob Dylan and Weezer and never get better."

"This is basically a talk that was given 30 years ago. We just have to keep giving it every few years because young guys come along and forget it."

@tswicegood
tswicegood / environment.yml
Last active November 17, 2021 23:22
Simple scraper for looking through a bunch of saved Craigslist listings for a phone number
# Conda environment file -- these packages are required for this script to work
name: craigslist
dependencies:
- lxml
- pip
- python=3.4*
- requests
- pip:
- aiohttp
- pyquery
@tswicegood
tswicegood / .gitconfig
Last active August 4, 2020 16:42
Couple of my favorite git aliases
[alias]
st = status
di = diff
staged = "diff --staged"
amend = "commit --amend"
delete-merged = "!git branch --merged | egrep -v '^\\*' | xargs git branch -d"
pad = "!git pull ${1:-origin} --prune && git delete-merged"
fad = "!git fetch ${1:-origin} --prune && git delete-merged"
#!/usr/bin/env bash
NAMESPACE=${1:-default}
DEPLOYMENTS=$(kubectl get deployments -n "${NAMESPACE}" -o jsonpath='{range .items[*]}{.metadata.name}{"\n"}')
for d in $DEPLOYMENTS; do
echo "Checking… $d"
kubectl -n $NAMESPACE rollout status --watch deployment $d;
done
@tswicegood
tswicegood / celery_logging.py
Created November 1, 2011 19:34
Simple code to hook up Celery and Loggly
LOGGLY_INPUT_KEY = "your key here"
import hoover
import logging
def initialize_loggly(loglevel=logging.WARN, **kwargs):
handler = hoover.LogglyHttpHandler(token=LOGGLY_INPUT_KEY)
log = logging.getLogger('celery')
log.addHandler(handler)
log.setLevel(loglevel)
#!/bin/bash
#
# Install Postgres 9.2, PostGIS and create PostGIS template on an Ubuntu 12.04 Server
# add official postgresql.org ubuntu repos (http://wiki.postgresql.org/wiki/Apt)
# Create /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg.
echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg2.list
# Import the repository key from http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc, update the package lists, and start installing packages:
@tswicegood
tswicegood / foo.py
Created May 25, 2013 20:58
Caption this Python
setattr(self, field, getattr(utils, '%s%s' % (prefix, field))(self))
@tswicegood
tswicegood / gist:5644776
Last active December 17, 2015 17:19
Example of how lambdas can generally be refactored into something more readable.
# using lambdas
def signed_in_both_chambers(self, **kwargs):
signed = lambda a: 'Signed in the %s' % a
return (self.filter(models.Q(bill_type='SB') | models.Q(bill_type='HB'))
.filter(actions__description=signed('House'))
.filter(actions__description=signed('Senate')))
# refactored into these methods
def has_action(self, action):
"""Filter QuerySet by a given action"""
@tswicegood
tswicegood / gist:5483232
Created April 29, 2013 17:29
Quick script for scraping the current rankins from the GEN public choice awards.
"""
Quick script for scraping the current rankins from the GEN public choice
awards.
"""
from pyquery import PyQuery as pq
import requests
URL = "https://app.wizehive.com/voting/dja2013/13447/%d"
entries = []