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 sys | |
if __name__=="__main__": | |
try: | |
path="./"+sys.argv[1] | |
except: | |
print "Use: python comas.py [filename]" | |
print "Wrong syntax or file not found" |
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 os, sys | |
if __name__=="__main__": | |
try: os.chdir(os.path.dirname(__file__)) | |
except OSError: pass | |
filepath="./"+sys.argv[1] | |
with open (filepath,"r") as listfile: | |
for line in listfile: | |
for filename in os.listdir("./"): |
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 os, sys, termios, tty | |
def getch(): | |
fd = sys.stdin.fileno() | |
old = termios.tcgetattr(fd) | |
try: | |
tty.setraw(fd) | |
return sys.stdin.read(33) | |
finally: |
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 bash | |
import os,random | |
if __name__=="__main__": | |
os.system('clear') | |
bullets=["O","O","O","O","O","O"] | |
bullets[random.randrange(6)]="X" | |
raw_input("? ? ? ? ? ?\nGo ahead!") | |
for i in range(6): | |
os.system('clear') |
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 sys | |
try: | |
price=int(sys.argv[1]) | |
tax={"A":21,"B":10,"C":4}[sys.argv[2]] | |
transp=(price*int(sys.argv[3]))/100 | |
totvar=price+((price+transp)*tax/100) | |
print "Base price: %i + %i%% VAT + %i%% transport = %i" %(price,tax,transp,totvar) | |
except: |
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
number=1234567890 | |
while 1: | |
if number%12==number%11==number%10==number%9==number%8==number%7==0 and set(list(str(number)))==set([str(a) for a in range(10)]):break | |
else: number+=10 | |
print number |
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 json,urllib2 | |
jsonshit=json.loads(urllib2.urlopen("http://developer.echonest.com/api/v4/song/search?results=100&api_key=MZFEPELDSKFX4WAMA&artist=%s"%raw_input("group? ",)).read()) | |
for x in jsonshit["response"]["songs"]: print "%s - %s"%(x["artist_name"],x["title"]) |
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 json,subprocess,urllib2 | |
jsonshit=json.loads(urllib2.urlopen("http://developer.echonest.com/api/v4/song/search?bucket=id:spotify&bucket=tracks&results=100&api_key=MZFEPELDSKFX4WAMA&artist=%s&title=%s"%(raw_input("group? ",),raw_input("title? ",))).read()) | |
print jsonshit["response"]["songs"][0]["artist_name"],jsonshit["response"]["songs"][0]["title"] | |
processeddata=json.loads(urllib2.urlopen("https://api.spotify.com/v1/tracks/"+jsonshit["response"]["songs"][0]["tracks"][0]["foreign_id"].split(':')[2]).read()) | |
subprocess.call(["vlc", processeddata["preview_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
#! /usr/bin/env python | |
import os,time | |
if __name__=="__main__": | |
print "Get ready!" | |
for i in range(3,0,-1): | |
print "%i..."%i, | |
time.sleep(1) | |
# Quarter stuff |
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 encode(string): | |
counter=1 | |
previous=out="" | |
for ind,i in enumerate(string): | |
if i==previous: counter+=1; previous=i | |
if ind+1==len(string) or i!=previous: | |
if counter>2: | |
if ind+1==len(string): out+="%i%s"%(counter,i) | |
else: out+="%i%s"%(counter,previous) | |
else: |
OlderNewer