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
| {{ $src := .Page.Resources.GetMatch (printf "images/%s" (.Get "src")) }} | |
| {{ $quality := default "q75" (.Get "quality") }} | |
| {{ $sizes := slice "400" "600" "800" "1200" }} | |
| {{ $jpgSrcSet := slice }} | |
| {{ $webpSrcSet := slice }} | |
| {{ range $i, $size := $sizes }} | |
| {{ $jpgImage := ($src.Resize (printf "%sx %s jpg" $size $quality)) }} |
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
| # export all | |
| gpg --export-secret-keys > keys.key | |
| # on another machine | |
| gpg --import keys.key | |
| # <Optional> import changes the trust status to unknown | |
| # You can | |
| # 1. export and impor the trust db | |
| gpg --export-ownertrust > trust.db |
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!"])) | |
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
| # 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
| #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
| 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
| #!/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
| 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
| 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" |
NewerOlder