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
# 1) set up EPEL | |
rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
# 2) install some dependencies | |
yum install -y pystache python-daemon python-lockfile | |
# 3) install aws-cfn-bootstrap | |
rpm -Uvh http://yum_server.example.com/yum/noarch/aws-cfn-bootstrap-1.4-8.3.el6.noarch.rpm | |
# 4) run cfn-init or signal error | |
/opt/aws/bin/cfn-init --region <Region> -s <StackId> -r db1 || /opt/aws/bin/cfn-signal -e 1 -r 'Failed to initialize server role using cfn-init' '<WaitHandle>' |
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
du -shx * | perl -e '%x=qw/K 1000 M 1000000 G 1000000000/;print sort {$a=~/^(\d+(?:\.\d+)?)([KMG])\s/ or die $a;my@a=($1,$2);$b=~/^(\d+(?:\.\d+)?)([KMG])\s/ or die $b;my@b=($1,$2);$b[0]*$x{$b[1]} <=> $a[0]*$x{$a[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
# search for Perl based projects updated in the last 3 months (as of 1/1/2015) | |
perl -MJSON -e '$d=decode_json scalar `curl https://staticsitegenerators.net/list.json 2> /dev/null`;print map {"$_->{name}\n"} grep {$_->{language} eq "Perl" && $_->{updated_at} =~ /^2015-0[789]/} @$d' |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.gnu.mailman</string> | |
<key>LaunchOnlyOnce</key> | |
<true/> | |
<key>Program</key> | |
<string>/usr/local/mailman/bin/mailmanctl</string> |
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
# vim | |
echo "au! BufRead,BufNewFile /tmp/* setlocal buftype=nofile" >> ~/.vimrc | |
echo "au! BufRead,BufNewFile /proc/* setlocal buftype=nofile" >> ~/.vimrc | |
echo "syntax on" >> ~/.vimrc | |
echo "set laststatus=2" >> ~/.vimrc | |
echo "set statusline=%f\ %h%w%m%r\ %=%(%l,%c%V\ %=\ %P%)" >> ~/.vimrc | |
# git | |
git config --global pager.diff "" | |
git config --global diff.external "/bin/bash -c 'vimdiff -o \"\$1\" \"\$4\"'" |
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
aws ec2 create-tags --resources $(perl -MJSON -e '$d=[grep{$_->{State}{Name}eq"running"&&!$_->{Tags}{somekey}}map{map{$_->{Tags}={map{($_->{Key}=>$_->{Value})}@{$_->{Tags}}};$_}@{$_->{Instances}}}@{(decode_json scalar `aws ec2 describe-instances`)->{Reservations}}];print join(" ",map{$_->{InstanceId}}@$d)') --tags Key=somekey,Value=somevalue |
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
#!/usr/bin/perl | |
$_ = join "", @ARGV; | |
s/^(0105)000000000005([0-9A-F]{40})$/$1$2/ | |
or die "usage: $0 <28 hex pairs>"; | |
print join("-", "S", unpack "c2 V4", pack "H*", $_)."\n" |
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
# match a div with class header_bar | |
/\<div(?:\s+\w+\=\"[^\"]*\")*\s+class\=\"[\w\-\s]*\bheader_bar\b/; | |
NewerOlder