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 watch { | |
while :; do clear; $@; sleep 2; 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
function pkill { | |
osascript -e 'tell application "'$1'" to quit saving no' | |
} |
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 macmount { | |
osascript -e 'mount volume "'$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
function getjson { | |
curl --silent $1 | python -c 'import sys, json; print json.load(sys.stdin)[sys.argv[1]]' $2 | |
} |
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
syntax on | |
color desert | |
" Search customisation | |
set showmatch | |
set incsearch | |
set hlsearch | |
set ignorecase | |
set smartcase |
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
# Check if a process is running or not | |
def is_proc_running(proc_name): | |
command = 'ps aux | grep -v grep | grep -v /bin/sh | grep ' + proc_name | |
output = subprocess.Popen(command, stdout=subprocess.PIPE, shell=True).communicate()[0] | |
if len(output)==0: | |
return False | |
else: | |
return True | |
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
$distance = 30000; | |
$radius_of_earth = 6335000; | |
$longitude_offset = ($distance / $radius_of_earth) * (180 / pi()) / cos(($latitude * pi())/180); | |
$latitude_offset = ($distance / $radius_of_earth) * (180 / pi()); | |
$max_longitude = $longitude + $longitude_offset; | |
$min_longitude = $longitude - $longitude_offset; | |
$max_latitude = $latitude + $latitude_offset; | |
$min_latitude = $latitude - $latitude_offset; |
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 facebook | |
import pprint | |
access_token = facebook.get_app_access_token(app_id, app_secret) | |
graph = facebook.GraphAPI(access_token) | |
graph.timeout = 30 | |
results = graph.request("search", {'type': 'place', 'q': query, 'center': latitude+','+longitude, 'distance': distance, 'fields': field_list}) | |
pprint.pprint(results) |