Skip to content

Instantly share code, notes, and snippets.

@myersjustinc
myersjustinc / 00-keynote_adamic.md
Last active October 5, 2015 16:38
Computation and Journalism Symposium 2015 notes

Keynote: Lada Adamic, Facebook

Political news exposure

  • Pew: Majority of millennials, Generation X get political news from Facebook (for Baby Boomers: local TV)

  • Does this lead to a filter bubble or echo chamber?

  • Why does Facebook want to do this research?

@myersjustinc
myersjustinc / scrape.js
Last active August 29, 2015 14:26
Scrape Twitter results page to TSV
// On a twitter.com page in Chrome with a stream of Tweets (e.g., a timeline or
// a search results page), copy and paste the code below into a JS console.
// You'll get back a tab-delimited, newline-separated string (watch out, it'll
// be big) that you can copy and paste directly into Excel.
$('.js-stream-tweet').map(function(i, tweetElem) {
var createdTimestamp = parseInt(tweetElem.querySelector('.js-short-timestamp').getAttribute('data-time-ms'), 10);
return {
created_at: new Date(createdTimestamp).toISOString(),
@myersjustinc
myersjustinc / tweak_brightness
Created February 11, 2015 23:18
Brightness up/down utility for my Chrubuntu setup
#!/bin/bash
CURRENT_BRIGHTNESS=$(pkexec xfpm-power-backlight-helper --get-brightness)
MIN_BRIGHTNESS=0
MAX_BRIGHTNESS=$(pkexec xfpm-power-backlight-helper --get-max-brightness)
POSSIBLE_STEPS=16
STEP_AMOUNT=$((($MAX_BRIGHTNESS - $MIN_BRIGHTNESS) / $POSSIBLE_STEPS))
function set_brightness() {
new_brightness=$1
@myersjustinc
myersjustinc / keybase.md
Created November 16, 2014 19:58
keybase.md

Keybase proof

I hereby claim:

  • I am myersjustinc on github.
  • I am myersjustinc (https://keybase.io/myersjustinc) on keybase.
  • I have a public key whose fingerprint is 7BBD 0FAE 3E22 A55E 5B22 024D 834B F8EF CB05 5E73

To claim this, I am signing this object:

@myersjustinc
myersjustinc / keybase.md
Created September 18, 2014 02:30
Keybase proof

Keybase proof

I hereby claim:

  • I am myersjustinc on github.
  • I am myersjustinc (https://keybase.io/myersjustinc) on keybase.
  • I have a public key whose fingerprint is 55C1 E8E1 E350 04EE 0F8A AC29 8FB6 0E44 B4A5 02BF

To claim this, I am signing this object:

@myersjustinc
myersjustinc / 02.make
Created November 20, 2013 20:19
gdal did not build on 10.9 when --with-mysql provided
This file has been truncated, but you can view the full file.
(cd port; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
(cd gcore; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
(cd frmts; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
(cd ogr; /Applications/Xcode.app/Contents/Developer/usr/bin/make lib )
/bin/sh /private/tmp/gdal-0yub/gdal-1.10.1/libtool --mode=compile --tag=CXX clang++ -arch x86_64 -g -O2 -DHAVE_SSE_AT_COMPILE_TIME -Wall -DOGR_ENABLED -I/usr/local/Cellar/gdal/1.10.1/include -I/private/tmp/gdal-0yub/gdal-1.10.1/port -I/usr/local -I/usr/local/include -I/usr/local -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/libpng -I/usr/local/opt/libpng/include -I/usr -I/usr/include -DHAVE_CURL -DHAVE_LIBZ -I/usr/local/Cellar/libxml2/2.9.1/include/libxml2 -DHAVE_LIBXML2 -c -o cpl_conv.lo cpl_conv.cpp
/bin/sh /private/tmp/gdal-0yub/gdal-1.10.1/libtool --mode=compile --tag=CXX clang++ -arch x86_64 -g -O2 -DHAVE_SSE_AT_COMPILE_TIME -Wall -I/private/tmp/gdal-0yub/gdal-1.10.1/port -I/private/tmp/gdal-0yu
@myersjustinc
myersjustinc / app.py
Created July 9, 2013 21:30
A quick test application in Flask
#!/usr/bin/env python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello, world!'
@myersjustinc
myersjustinc / sheet_utils.py
Created May 13, 2013 17:43
Handle XLSX spreadsheet row contents as Python dicts
import openpyxl
def get_row_as_dict(ws, row_num):
header_cells = ws.rows[0]
record_cells = ws.rows[row_num]
record_dict = {}
for record_cell in record_cells:
header_name = None
@myersjustinc
myersjustinc / adjustForInflation.js
Last active December 11, 2015 21:58
Quick function to adjust for inflation
var adjustForInflation = function(amount, yearFrom, yearTo) {
// Annual average CPI-U figures from BLS:
// http://www.bls.gov/cpi/cpifiles/cpiai.txt
//
// If you want the current year as well, BLS' inflation calculator suggests
// using the most recent monthly index value since there won't be an annual
// average available yet: http://www.bls.gov/cpi/cpicalc.htm
var cpi = {
1913: 9.9, 1914: 10.0, 1915: 10.1, 1916: 10.9, 1917: 12.8, 1918: 15.1,
1919: 17.3, 1920: 20.0, 1921: 17.9, 1922: 16.8, 1923: 17.1, 1924: 17.1,
@myersjustinc
myersjustinc / README.md
Created November 19, 2012 17:05
mapnik failed to build on 10.8.2

Trying to install Mapnik on a Mac Pro (early 2009) with 10.8.2, but it isn't building for me.

The troubleshooting instructions ask for three things in this gist:

  • Output from HOMEBREW_MAKE_JOBS=1 VERBOSE=1 brew install mapnik, which are in brew-install.txt.
  • Largest numbered log from ~/Library/Logs/Homebrew/mapnik. No numbered logs existed in that directory yet, so I included the one file (config.log) that was present there.
  • Output from brew doctor, which is very unexciting but is included in brew-doctor.txt.