This file contains hidden or 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
class RankArray(object): | |
"""An array with negative index positions""" | |
average=None | |
pos=[] | |
neg=[] | |
def __init__(self,average,pos,neg): |
This file contains hidden or 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
setTimeout( function(){ windowReload() }, 2000 ); | |
function windowReload(){ | |
if(!window.location.hash) { | |
window.location = window.location + '#loaded'; | |
window.location.reload(); | |
}else{ | |
if (history && history.pushState){ | |
history.pushState( null, null, window.location.href.split('#')[0] ); | |
} | |
} |
This file contains hidden or 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
// get google. js/jsapi.js | |
// go to doc. create spreasheet. publish it. | |
var docKey = ''; | |
var url = 'http://spreadsheets.google.com/feeds/list/' + docKey +'/od6/public/values?alt=json'; | |
$(document).ready(function(){ | |
google.load('feeds', '1', { 'callback' : function(){ | |
($.getJSON(url, 'callback=?')).success(function(data){ | |
$(data.feed.entry).each(function(i,entry){ |
This file contains hidden or 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
var jq = document.createElement('script'); | |
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"; | |
document.getElementsByTagName('head')[0].appendChild(jq); | |
// ... give time for script to load, then type. | |
jQuery.noConflict(); |
This file contains hidden or 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
# gets everything for a single page... | |
wget -E -H -k -K -p http://www.site.com.au/path/topage | |
# gets the whole site... | |
wget -r -p -U wget -r -p -U Mozilla http://www.site.com.au |
This file contains hidden or 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
// scrape web data into google doc cell with formulas. | |
i.e | |
= IMPORTXML("http://en.wikipedia.org/wiki/Test_cricket","//html") | |
takes an xpath right into neigbouring cell. could be useful. |
This file contains hidden or 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
i pulled an ubuntu12/nginx container with docker. | |
install a bunch of stuff... | |
sudo apt-get update | |
sudo apt-get -y install build-essential | |
sudo apt-get install xvfb | |
sudo apt-get install xfs xfonts-scalable xfonts-100dpi | |
sudo apt-get install libgl1-mesa-dri | |
sudo apt-get install subversion libqt4-webkit libqt4-dev g++ |
This file contains hidden or 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/bash | |
# Bash script to install latest version of ffmpeg and its dependencies on Ubuntu 12.04 or 14.04 | |
# Inspired from https://gist.github.com/faleev/3435377 | |
# Remove any existing packages: | |
sudo apt-get -y remove ffmpeg x264 libav-tools libvpx-dev libx264-dev | |
# Get the dependencies (Ubuntu Server or headless users): | |
sudo apt-get update |
This file contains hidden or 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
#remove ones not using | |
docker ps -a | grep "salttest" | awk '{print $1}' | xargs docker rm |
This file contains hidden or 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
bash profile addition to pass messages to slack | |
function slack() | |
{ | |
join="{ \"username\": \"mike\", \"text\": \""$@"\" , \"icon_emoji\": \":ghost:\"}" | |
curl -X POST --data-urlencode "payload=$join" https://hooks.slack.com/services/YOUR/PRIVATE/CODE | |
} | |
OlderNewer