Skip to content

Instantly share code, notes, and snippets.

View pedramamini's full-sized avatar
👋

Pedram Amini pedramamini

👋
View GitHub Profile
@pedramamini
pedramamini / osx_messages_peek.py
Created May 20, 2015 05:04
Extract URLs and related contact information from your OSX Messages.app database.
#!/usr/bin/env python
# Extract URLs and related contact information from your OSX Messages.app database.
#
# TODO
# - automatically resolve username and discover contacts database (by largest item count if there is more than one).
# - make a machine parseable format.
# - keep track of last found URL (by hash?), allow for periodic run of script and addition to output.
# - update to latest gruber regex.
@pedramamini
pedramamini / blaze.py
Last active February 15, 2025 17:27
Blaze your way through Tinder (the dating app).
#!/usr/bin/env python
"""
blaze through tinder
Setup:
- proxy / sniff out your auth token and edit constant under imports.
- API may have changed.
- it's hard coded to search for girls looking for guys.
- this was a quick hack, i'm not maintaining it or answering questions about it.
#!/usr/bin/env python
"""
Desktop Background Rotater
Background images:
http://bitday.me
Crontab entry:
# min hr mday month wday command
@pedramamini
pedramamini / split_mbox_by_year.py
Last active August 29, 2015 14:11
Break an mbox file out into multiple files by year. Written to chunk my GMail Takeout into manageable pieces.
#!/usr/bin/env python
"""
What
Break an mbox file out into multiple files by year.
Written to chunk my GMail Takeout into manageable pieces.
Will prefix YEAR- to mbox name and *append* to those file names.
Who
Pedram Amini
@pedramamini
pedramamini / keybase.md
Created September 30, 2014 16:52
keybase.io proof of ID.

Keybase proof

I hereby claim:

  • I am pedramamini on github.
  • I am pedram (https://keybase.io/pedram) on keybase.
  • I have a public key whose fingerprint is 0724 E980 0B61 5F47 F78E 850C 3232 2632 B543 8A67

To claim this, I am signing this object:

@pedramamini
pedramamini / levenshtein_distance.py
Created September 22, 2014 23:12
Provides the Levenshtein distance between two strings. ie: The number of transformations required to transform one string to the other
########################################################################################################################
def levenshtein_distance (first, second):
"""
Provides the Levenshtein distance between two strings. ie: The number of transformations required to transform
one string to the other.
@type first: String
@param first: First string.
@type second: String
@param second: Second string.
@pedramamini
pedramamini / bash_prompt.sh
Last active August 29, 2015 14:06
Git aware prompt that shows dirty state and unsynced commit state.
function parse_git_dirty() {
[[ $(git status 2> /dev/null | tail -n1) != *"working directory clean"* ]] && echo "*"
}
function parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
# requires the following in .gitconfig under [alias] section:
# unpushed = !GIT_CURRENT_BRANCH=$(git name-rev --name-only HEAD) && git log origin/$GIT_CURRENT_BRANCH..$GIT_CURRENT_BRANCH --oneline
@pedramamini
pedramamini / pedram-sublimetext-setup.md
Last active January 1, 2016 06:29
My SublimeText setup.

I'm running SublimeText 3 beta on MacOS, but this should apply everywhere. My user prefs:

{
	"always_show_minimap_viewport": true,
	"bold_folder_labels": true,
	"drag_text": false,
	"draw_minimap_border": true,
	"ensure_newline_at_eof_on_save": true,
	"highlight_line": true,
"""
USB Missile Launcher Python Interface
written by Pedram Amini <[email protected]>
http://dvlabs.tippingpoint.com/blog/2009/02/12/python-interfacing-a-usb-missile-launcher
"""
import ctypes
import struct
import time
import random
def random_fact ():
return facts[random.randint(0, len(facts)-1)]
facts = \
[
"Chuck Norris' tears cure cancer. Too bad he has never cried. Ever.",
"Chuck Norris does not sleep. He waits.",
"Chuck Norris is currently suing NBC, claiming Law and Order are trademarked names for his left and right legs.",