wget https://opscode-omnibus-packages.s3.amazonaws.com/ubuntu/12.04/x86_64/chefdk_0.2.0-2_amd64.deb
sudo dpkg -i chefdk_0.2.0-2_amd64.deb
mkdir -p ~/.chefdk
echo 'eval "$(chef shell-init bash)"' >> ~/.bashrc
echo 'export PATH="/opt/chefdk/embedded/bin:${HOME}/.chefdk/gem/ruby/2.1.0/bin:$PATH"' >> ~/.bashrc
wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.3_x86_64.deb
sudo dpkg -i vagrant_1.6.3_x86_64.deb
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
duration_1 = 0; | |
duration_2 = 0; | |
iter = 100000; | |
for i=1:iter | |
if mod(i,2) == 0 | |
tic; | |
a = now(); | |
duration_1 = duration_1 + toc; | |
else | |
tic; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
# Add this function to your ~/.bashrc file to allow you to jump to the top of a complex dir tree | |
# | |
# Examples: | |
# user@host:~/git_stuff/git_repo1/dir1/subdir/subsubdir $ cdr | |
# user@host:~/git_stuff/git_repo1 $ | |
# | |
# user@host:~/svn_stuff/svn_repo1/dir1/subdir/subsubdir $ cdr | |
# user@host:~/svn_stuff/svn_repo1 $ | |
# | |
# user@host:~/just/a/normal/dir/structure $ cdr |
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
sudo tcpdump -s 0 -A -i lo0 'tcp port 8080 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)' |
I recently worked on a project where I needed to pull in a reasonably sized data set only to filter away a large majority of it. Needless to say the memory implications for scaling this up were concerning. So here's a quick demo of a problem where we want to pull in a list of all the words that start with "B" from a dictionary. The two methods are 1) the original pull in the dictionary then filter down to the "B"'s and 2) filter the data on ingress. Option 2)'s maximum memory consumption is approximately 6% of option 1.
library(pryr)
DICTIONARY <- '/etc/dictionaries-common/words'
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 csv | |
# cat First500000.lst | |
# 0,a | |
# 1,a | |
# 2,a | |
# 3,a | |
# 4,a | |
# 5,a | |
# 6,a |
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
/* | |
Lexicographic Permutations | |
source: http://en.wikipedia.org/wiki/Permutation#Generation_in_lexicographic_order | |
The following algorithm generates the next permutation lexicographically | |
after a given permutation. It changes the given permutation in-place. | |
1) Find the largest index k such that a[k] < a[k + 1]. | |
If no such index exists, the permutation is the last permutation. |
OlderNewer