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
| import urllib | |
| def start_download(url, base, limit, ctype, ext,file_save_dir): | |
| """Download 'limit' number of files in base+offset.ext form(ex: 2400.jpg to 2452.jpg) from a url | |
| Args: | |
| url: url including the terminal slash | |
| base: base number of the filename | |
| limit: number of files to fetch | |
| ctype: content type of the file | |
| ext: extension of the file |
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
| #Install Sublime Text 2 | |
| sudo add-apt-repository ppa:webupd8team/sublime-text-2 | |
| sudo apt-get update | |
| sudo apt-get install sublime-text | |
| #Install Oracle Java | |
| sudo add-apt-repository ppa:webupd8team/java | |
| sudo apt-get install oracle-java7-installer | |
| sudo update-alternatives --config java |
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
| HISTFILESIZE=2500 | |
| HISTIGNORE="ls:ltrh:ls -l:ls -ltrh:pwd:clear:c:ll" | |
| export JAVA_HOME=$(/usr/libexec/java_home) | |
| export DYLD_LIBRARY_PATH="/Developer/NVIDIA/CUDA-5.5/lib:$DYLD_LIBRARY_PATH" | |
| export PATH="/usr/local/bin:$PATH" | |
| export PATH="$PATH:/usr/local/smlnj/bin" | |
| export PATH="/usr/local/mysql/bin:$PATH" | |
| export PATH="/Developer/NVIDIA/CUDA-5.5/bin:$PATH" |
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
| for host in falcon{1..4} | |
| do | |
| echo "==== $host ===="; | |
| #Number of slabs memcached uses on my system is 40. Change it appropriately | |
| for i in {1..36} | |
| do | |
| echo "retrieving for slab "$i; | |
| (sleep 1; echo "stats cachedump $i 1000"; sleep 2;) | telnet $host 11211 >> keysmemcached_$host; | |
| done; | |
| echo "done for all slabs..Now processing"; |
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
| #!/usr/bin/env python | |
| #run the following bash one liner to gather statistics first followed by python script to calculate hit ratio & average hit ratio | |
| #for i in mem-node{1..30}; do (echo "stats"; sleep 2 ) | telnet $i 11211 | grep get_ ; done > stats; python avg.py stats | |
| import sys | |
| from __future__ import division | |
| x = [int(i.strip().split()[2]) for i in open(sys.argv[1]).readlines()] | |
| hitratios=[x[2*i]/(x[2*i]+x[2*i+1]) for i in range(len(x)/2)] | |
| for hr in hitratios: | |
| print hr |
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 DatesInYear(object): | |
| def __init__(self, year): | |
| from calendar import monthrange | |
| self.days = [] | |
| for m in xrange(1,13): | |
| number_of_days = monthrange(year, m)[1] | |
| for d in xrange(1,number_of_days+1): | |
| self.days.append((year, m, d)) |
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
| #Install java 8 | |
| add-apt-repository ppa:webupd8team/java | |
| apt-get update && sudo apt-get install oracle-java8-installer | |
| #create hadoop group and a user | |
| addgroup hadoop | |
| adduser --ingroup hadoop hduser | |
| #switch to hduser account | |
| su hduser |
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
| # Install python/python3 using brew | |
| brew install python | |
| brew install python3 | |
| #in pelican/blog/path | |
| virtualenv -p python3 venv_pelican | |
| source venv_pelican/bin/activate | |
| pip3 install six==1.9.0 | |
| pip3 install pelican markdown typogrify |
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/sh | |
| echo "Checking whether brew is installed..." | |
| if test ! $(which brew); then | |
| echo "Installing homebrew..." | |
| ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| fi | |
| brew tap d12frosted/emacs-plus | |
| brew tap caskroom/cask |
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
| SHELL = python | |
| .PHONY: greet | |
| greet: | |
| print(" ".join(["Hello", "World!"])) | |
OlderNewer