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
55 * * * * /usr/local/bin/growlnotify -m "take a quick break. look away" --image "/Users/shreyans/Pictures/wallpaper/langkawi_beach_small.jpg" --wait > /dev/null 2>&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
parse_git_dirty() { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
parse_git_branch() { | |
git branch 2> /dev/null | sed -e "/^[^*]/d" -e "s/* \(.*\)/(\1$(parse_git_dirty))/" | |
} | |
PROMPT_COMMAND='CurDir=`pwd|sed -e "s!$HOME!~!"|sed -E "s!([^/])[^/]+/!\1/!g"`' | |
PS1='[\u@\h $CurDir $(parse_git_branch)]\$ ' |
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 | |
import re | |
import datetime | |
def get_connections(): | |
curl_cmd = "curl -s -u username:password http://192.168.1.1/Log_View.asp | grep 'received REQUEST'" | |
# TODO replace with subprocess.Popen() | |
resp = os.popen4(curl_cmd)[1].read() | |
resp = resp.split('\n') | |
connections = [] |
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 hmac | |
import base64 | |
import hashlib | |
# simplejson is available at: http://pypi.python.org/pypi/simplejson/ | |
import simplejson as json | |
class RequestSigner(object): | |
def verify_and_load_signed_request(self, signed_request, secret): | |
"""Verify the signature, and return decoded data from a signed_request value""" | |
try: |
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; import appscript; import time | |
os.popen('open facetime://6461234567') | |
appscript.app('FaceTime').activate(); time.sleep(2); appscript.app('System Events').keystroke('\r') |
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 urllib2 | |
from BeautifulSoup import BeautifulSoup | |
airport_list = ["jfk", "ewr", "lga"] | |
def getAllTerminals(): | |
terminals = {} | |
for airport in airport_list: | |
terms = klass._getTerminals(airport) |
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 time | |
import datetime | |
def datetime_to_timestamp(datetime_ob): | |
return time.mktime(datetime_ob.timetuple()) | |
def datetime_from_timestamp(timestamp): | |
return datetime.datetime.fromtimestamp(timestamp) |
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
@classmethod | |
def get_matches_for_status_matched(klass, ride_doc): | |
ride=[] | |
# first ensure status is matched | |
if ride_doc.get(Ride.A_STATUS) != 2: return ride | |
# get the match ride and user info | |
match_ride_id = ride_doc.get(Ride.A_MATCH_ID) | |
if not match_ride_id: return ride |
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
# create screen. can optionally specify the process to run in it here, | |
# or can do that when the screen has started | |
$ screen -S firstscreen | |
# run a process in it | |
(inscreen)$ processone | |
# get out of the screen: 'ctrl-a + d' ('d' for detach) | |
> ctrl-a + d | |
[detached from 24550.firstscreen] |
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 math | |
>>> math.pi / 3 | |
1.0471975511965976 | |
>>> angle = _ | |
>>> math.cos(angle) | |
0.50000000000000011 | |
>>> _ | |
0.50000000000000011 |
OlderNewer