Skip to content

Instantly share code, notes, and snippets.

View abk-chicago's full-sized avatar
💭
working in a new field.

Andrea Kim abk-chicago

💭
working in a new field.
View GitHub Profile
@abk-chicago
abk-chicago / introrx.md
Created January 9, 2017 01:56 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@abk-chicago
abk-chicago / dex.sh
Created February 15, 2017 22:52 — forked from JakeWharton/dex.sh
`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ and dexdump from the build-tools in the Android SDK be on your PATH.
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')
@abk-chicago
abk-chicago / dex.sh
Created February 15, 2017 22:52 — forked from JakeWharton/dex.sh
`classes.dex` method count helpers. Requires smali/baksmali from https://code.google.com/p/smali/ and dexdump from the build-tools in the Android SDK be on your PATH.
function dex-method-count() {
cat $1 | head -c 92 | tail -c 4 | hexdump -e '1/4 "%d\n"'
}
function dex-method-count-by-package() {
dir=$(mktemp -d -t dex)
baksmali $1 -o $dir
for pkg in `find $dir/* -type d`; do
smali $pkg -o $pkg/classes.dex
count=$(dex-method-count $pkg/classes.dex)
name=$(echo ${pkg:(${#dir} + 1)} | tr '/' '.')
@abk-chicago
abk-chicago / csv_monster.py
Created February 24, 2017 19:26 — forked from mrosata/csv_monster.py
Improved CSV File merger/File splitter that I created to help with large amounts of .csv work I've been doing.
"""Created by Michael Rosata
Python 2.7
Merge together .csv files. I'm creating this because I have 30 .csv files which need to be concatenated.
I also have many files which need to be split, so I've added splitting functionality to this as well.
"""
import csv
import sys
@abk-chicago
abk-chicago / tweet_listener.py
Created March 21, 2017 14:21 — forked from hugobowne/tweet_listener.py
Here I define a Tweet listener that creates a file called 'tweets.txt', collects streaming tweets as .jsons and writes them to the file 'tweets.txt'; once 100 tweets have been streamed, the listener closes the file and stops listening.
class MyStreamListener(tweepy.StreamListener):
def __init__(self, api=None):
super(MyStreamListener, self).__init__()
self.num_tweets = 0
self.file = open("tweets.txt", "w")
def on_status(self, status):
tweet = status._json
self.file.write( json.dumps(tweet) + '\n' )
self.num_tweets += 1