Skip to content

Instantly share code, notes, and snippets.

Serdar Tumgoren zstumgoren

Block or report user

Report or block zstumgoren

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View failed_banks_count.py
import csv
import os
import urllib.request
url = 'https://www.fdic.gov/bank/individual/failed/banklist.csv'
source_file = os.path.expanduser('~/Desktop/failed_banks.csv')
urllib.request.urlretrieve(url, source_file)
with open(source_file, 'r', encoding="latin-1") as failed_banks:
@zstumgoren
zstumgoren / gist:3a63d0183ae05e27a5ef15dd82ba6bf5
Last active Jul 28, 2017
bundler error when installing Fech from source
View gist:3a63d0183ae05e27a5ef15dd82ba6bf5
### Gemfile ###
cd ~/test
less Gemfile
source 'https://rubygems.org'
gem 'fech', git: 'https://github.com/NYTimes/Fech.git', :tag => 'v1.8', :submodules => true
#### CLI output ####
# Below run by a user with no ssh keys
~/test$ bundle
@zstumgoren
zstumgoren / election_results_py3.py
Created Mar 1, 2017
Python3 port of election_results.py for NICAR17 PyHumans bootcamp
View election_results_py3.py
"""
A monstrosity of an election results script. Calculates total votes for
races and candidates, and determines if there is a winner in each race.
This module bundles together way too much functionality and is near impossible
to test, beyond eye-balling results.
USAGE:
python election_results.py
@zstumgoren
zstumgoren / Python_intermediate_notes.md
Last active Aug 14, 2017
Python Intermediate (Code Design)
View Python_intermediate_notes.md
@zstumgoren
zstumgoren / election_results.py
Last active Mar 1, 2016
Elec results script for shredding at NICAR
View election_results.py
import csv, urllib
from operator import itemgetter
from collections import defaultdict
from os.path import dirname, join
url = "https://docs.google.com/spreadsheet/pub?key=0AhhC0IWaObRqdGFkUW1kUmp2ZlZjUjdTYV9lNFJ5RHc&output=csv"
filename = join(dirname(dirname(__file__)), 'fake_va_elec_results.csv')
urllib.urlretrieve(url, filename)
reader = csv.DictReader(open(filename, 'rb'))
View gist:e1a27c55f77d51c7ff10
~/code/ruby/ap/devops/vmfarm/puppet/private> cd projects/
~/code/ruby/ap/devops/vmfarm/puppet/private/projects> pwd
/Users/stumgoren/code/ruby/ap/devops/vmfarm/puppet/private/projects
~/code/ruby/ap/devops/vmfarm/puppet/private/projects> git branch -a
error: object directory /root/.r10k/git/https---git.ap.org-puppet-puppet-projects.git/objects does not exist; check .git/objects/info/alternates.
master
remotes/cache/master
remotes/origin/HEAD -> origin/master
remotes/origin/master
~/code/ruby/ap/devops/vmfarm/puppet/private/projects> git remote show
View postgres prodesses
~/code/ruby/ap/apme-power-grid/data/source/ferc> ps aux | grep postgres
stumgoren 384 0.0 0.0 2441432 1356 ?? Ss 8:36AM 0:06.43 postgres: stats collector process
stumgoren 383 0.0 0.0 2585880 2004 ?? Ss 8:36AM 0:02.38 postgres: autovacuum launcher process
stumgoren 382 0.0 0.0 2585748 640 ?? Ss 8:36AM 0:00.16 postgres: wal writer process
stumgoren 381 0.0 0.0 2585748 1484 ?? Ss 8:36AM 0:00.18 postgres: writer process
stumgoren 380 0.0 0.0 2585748 704 ?? Ss 8:36AM 0:00.01 postgres: checkpointer process
stumgoren 332 0.0 0.1 2585748 13412 ?? S 8:36AM 0:01.64 /usr/local/opt/postgresql/bin/postgres -D /usr/local/var/postgres -r /usr/local/var/postgres/server.log
stumgoren 9151 0.0 0.0 2432768 624 s003 S+ 2:22PM 0:00.00 grep postgres
View gist:de305cae9a082f929d1e
dcloud_analytics_production | documentcloud | SQL_ASCII | C | C |
dcloud_crowd_production | documentcloud | SQL_ASCII | C | C |
dcloud_production | documentcloud | SQL_ASCII | C | C |
fantasy_football | fantasy_football | UTF8 | en_US.utf8 | en_US.utf8 |
overview-prod | overview | SQL_ASCII | C | C |
overview-test3 | overview | SQL_ASCII | C | C |
panda | panda | SQL_ASCII | C | C | =T/panda +
| | | | | panda=CTc/panda
postgres | postgres | SQL_ASCII | C | C |
template0 | postgres | SQL_ASCII | C | C | =c/postgres +
View keybase.md

Keybase proof

I hereby claim:

  • I am zstumgoren on github.
  • I am zstumgoren (https://keybase.io/zstumgoren) on keybase.
  • I have a public key whose fingerprint is 3F12 C03F DD5F A97C 6558 6D9D B714 2960 143C 8E41

To claim this, I am signing this object:

@zstumgoren
zstumgoren / scraper.py
Created May 5, 2015
Tweaks to scraper code for Fish
View scraper.py
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import urllib2
import csv
import re
# NOTE: using live URL sted of locally cached file
URL = "http://cpms.dfa.state.nm.us/doShowAppropriations.aspx?pid=10-1100"
page = urllib2.urlopen(URL)
html = page.read()
You can’t perform that action at this time.