This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Wrote this to find free licenses of TotalFinder , after which they discontinued their coupon offers | |
import base64, string, urllib2, itertools, multiprocessing | |
totallist = list(set(j+"".join(i) for i in list(itertools.permutations(string.ascii_uppercase*3, 3)) for j in string.digits)) | |
baseurl = base64.decodestring('aHR0cDovL3NpdGVzLmZhc3RzcHJpbmcuY29tL2JpbmFyeWFnZS9wcm9kdWN0L3RvdGFsZmluZGVy\nZnJlZT9jb3Vwb249VEhBTktT\n') | |
def isValid(code): | |
url = baseurl+code | |
if not("is not a valid coupon." in urllib2.urlopen(url).read()): | |
print code, url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void (^assetEnumerator)(ALAsset* result, NSUInteger index, BOOL*); | |
void (^groupEnumerator)(ALAssetsGroup*, BOOL *); | |
void (^faliure)(NSError*); | |
groupEnumerator = ^(ALAssetsGroup *group, BOOL *stop){ | |
[group enumerateAssetsUsingBlock:assetEnumerator]; | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ogg2mp3() { | |
for f in * | |
do | |
ffmpeg -i "$f" -ab 500k "$f.mp3" | |
done | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
if appIsRunning("Google Chrome") then | |
tell application "Google Chrome" | |
get URL of active tab of window 1 | |
end tell | |
end if | |
on appIsRunning(appName) | |
tell application "System Events" to (name of processes) contains appName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
tell application "System Events" | |
set frontApp to name of first application process whose frontmost is true | |
end tell | |
tell application frontApp | |
if the (count of windows) is not 0 then | |
set window_name to name of front window | |
end if |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fortune -s -n 100 | cowsay -f `ls -1 /usr/local/Cellar/cowsay/3.03/share/cows/ | sed s/\.cow// | tail -n +\`echo $(( 1 + (\\\`od -An -N2 -i /dev/random\\\`) % (\\\`ls -1 /usr/local/Cellar/cowsay/3.03/share/cows/ | wc -l\\\`) ))\` | head -1` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def findAllPerm(string): | |
def findAll(slist): | |
if len(slist)==1: | |
return slist | |
else: | |
biglist = [] | |
for i in xrange(len(slist)): | |
temp = [slist[i]] | |
temp.extend(findAll(slist[:i]+slist[i+1:])) | |
if len(temp)==2 and type(temp[0])==type(''): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def flatten(listy_list): | |
return ''.join([x if type(x)==type('') else flatten(x) for x in listy_list ]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import urllib2 | |
import psycopg2 | |
from time import strftime | |
from datetime import date, timedelta, datetime | |
from geopy import geocoders | |
from BeautifulSoup import BeautifulSoup | |
from multiprocessing import Pool, cpu_count | |
conn = psycopg2.connect("dbname=mydb user=ideamonk password=geodb") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Author: ideamonk | |
*/ | |
window.scissors = { | |
MAX_GRADIENT:179.606, | |
GRADIENT_SEARCH:32, | |
radius:16, | |
MIN_GRADIENT:63, | |
COST_WIDTH:2, |