Skip to content

Instantly share code, notes, and snippets.

geekman

Block or report user

Report or block geekman

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
@geekman
geekman / image_renamer.py
Created Feb 25, 2014
image files renamer
View image_renamer.py
#!/usr/bin/python
#
# renames a directory of files with their image extension
# currently works with only JPEG and PNG files
#
# 2014.02.25 darell tan
#
import os
import sys
@geekman
geekman / flatten_objs.js
Created Jun 19, 2014
flattens JS object hierarchies (used for shaping data for D3.js)
View flatten_objs.js
//
// flattens object hierarchies like {'US': {'AZ': {size: 999, ...} } }
// into array of "rows" like {country: 'US', state: 'AZ': size: 999, ...}
// e.g. flatten(data, 2, ['country', 'state'])
//
// values can also form another level like so:
// e.g. flatten(data, 3, ['country', 'state', 'stat'])
// which produces: {country: 'US', state: 'AZ', stat: 'size', value: 999}
//
// NOTE: modifies objects directly, so don't run multiple times with diff levels
@geekman
geekman / zip-itead.cmd
Created Jul 9, 2014
zips up generated Gerber files in a directory
View zip-itead.cmd
cd %1
zip itead-gerbers.zip *.GTL *.GBL *.GTS *.GBS *.GTO *.GBO *.TXT *.GKO *.GMO
pause
@geekman
geekman / extract.py
Created Dec 24, 2014
mass-extract permissions & features from Android manifest
View extract.py
#!/usr/bin/env python
#
# extract permissions and features from Android manifest
# put this script into the androguard directory
#
import os
import sys
import csv
import traceback
@geekman
geekman / ipynb_renum.py
Created Dec 25, 2014
sequentially re-numbers cells in an IPython Notebook file
View ipynb_renum.py
#!/usr/bin/python
#
# sequentially re-numbers cells in an IPython notebook
# 2014.12.26 darell tan
#
import json
import sys
def main():
@geekman
geekman / yahoo_pf_export.user.js
Last active Aug 29, 2015
user script to export Yahoo finance portfolio
View yahoo_pf_export.user.js
// ==UserScript==
// @name Yahoo! Finance Portfolio Export
// @description Adds a button that lets you export your portfolio
// @author Darell Tan
// @version 1.2
// @namespace https://gist.github.com/geekman
// @match https://finance.yahoo.com/portfolio/pf_*/holdings/edit*
// @match https://*.finance.yahoo.com/portfolio/pf_*/holdings/edit*
// ==/UserScript==
@geekman
geekman / merge_srt.py
Created Feb 1, 2015
merge OCR fuck-ups in SRT file
View merge_srt.py
#!/usr/bin/env python
#
# merges screwed up OCR'ed subs, which generated 2 separate items for the same
# text, maybe sometimes with italics or not, or different upper/lower case
#
import sys
from pysrt import SubRipFile
@geekman
geekman / circles.ipynb
Created May 12, 2015
D3.js sunburst concentric rings visualization
View circles.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@geekman
geekman / modzip.py
Created Jul 1, 2015
Patches file attributes in ZIP files
View modzip.py
#!/usr/bin/python
#
# modifies zip file attributes
# 2015.07.01 darell tan
#
from zipfile import *
import struct
import sys
@geekman
geekman / foxit_hist.py
Created Aug 31, 2015
dumps Foxit Reader history from registry
View foxit_hist.py
#
# lists Foxit Reader last opened files from registry
# 2015.08.31 darell tan
#
from _winreg import *
from ctypes import windll, create_unicode_buffer
def GetLongPathName(path):
You can’t perform that action at this time.