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
import sys | |
arguments = sys.argv | |
arguments = arguments[1:] | |
command = arguments[0] | |
help=""" | |
usage: | |
tasks.py add "learn python" "write code" | |
tasks.py delete [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
start_year = 1977 | |
end_year = 2015 | |
ltr_year = 2004 | |
link = "http://berkshirehathaway.com/letters/" | |
for i in range(start_year, end_year): | |
if i <ltr_year: | |
print(link+str(i)+".html") | |
else: | |
print(link+str(i)+"ltr.pdf") |
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
import os | |
from commands import getoutput | |
from socket import gethostname | |
hostname = gethostname() | |
username = os.environ['USER'] | |
pwd = os.getcwd() | |
homedir = os.path.expanduser('~') | |
pwd = pwd.replace(homedir, '~', 1) | |
if len(pwd) > 30: | |
pwd = pwd[:10]+'...'+pwd[-20:] # first 10 chars+last 20 chars |
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
# -*- coding: utf-8 -*- | |
#/usr/bin/python3 | |
""" | |
flash | |
April 21, 28, may 5, may 12, may 19 | |
arrow | |
april 22, 29, may 6, may 13 | |
person of interest |
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
#!/bin/python | |
def insert_post(post): | |
try: | |
cursor.execute("select max(post_id) from post_master") | |
fetched = cursor.fetchone() | |
if fetched is None: | |
post_id=0 | |
else: | |
post_id = fetched+1 | |
cursor.execute('insert into post_master\ |