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
# Adding simple colorization to our outputs | |
class String | |
# colorization | |
def colorize(color_code) | |
"\e[#{color_code}m#{self}\e[0m" | |
end | |
def black | |
colorize(30) | |
end | |
def red |
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
redis-cli rpush "resque:queue:myqueue" '{"class":"MyModel","args":["arg1"]}' |
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
# expects seconds, returns pretty string of how long ago event happened | |
def ago(seconds) | |
a = seconds | |
case a | |
when 0 then "just now" | |
when 1 then "a second ago" | |
when 2..59 then a.to_s+" seconds ago" | |
when 60..119 then "a minute ago" #120 = 2 minutes | |
when 120..3540 then (a/60).to_i.to_s+" minutes ago" | |
when 3541..7100 then "an hour ago" # 3600 = 1 hour |
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
TERM_CHILD=1 QUEUES=* VVERBOSE=1 rake resque:work --trace |
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
### Ask for SENSITIVE DATA: | |
puts "\nLet's help you generate the RSA keys and distribute it to your machines.\n\n" | |
print "Enter a secret passphrase to use for the key (save it well!): " | |
passphrase = gets.strip | |
print "Enter how many iterations (500 for security + performance, 1000 > for maximum security):" | |
iterations = gets.strip | |
print "Enter the name of the remote user: " |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html><head> | |
<title>HTML Canvas Flag Wave</title> | |
<style type="text/css" media="screen"> | |
body { background:#eee } | |
#flag { position:absolute; top:50%; left:50% } | |
</style> | |
<script type="text/javascript"> | |
window.onload = function(){ |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html><head> | |
<title>HTML Canvas Flag Wave</title> | |
<style type="text/css" media="screen"> | |
body { background:#eee } | |
#flag { position:absolute; top:50%; left:50% } | |
</style> | |
<script type="text/javascript"> | |
window.onload = function(){ |
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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | |
<html><head> | |
<title>HTML Canvas Flag Wave</title> | |
<style type="text/css" media="screen"> | |
body { background:#eee } | |
#flag { position:absolute; top:50%; left:50% } | |
</style> | |
<script type="text/javascript"> | |
var h = new Image; |
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
# say you save this as clear.sh | |
# chmod +x clear.sh | |
# usage: ./clear.sh <host1> <host2> <host..n> | |
for var in "$@" | |
do | |
echo "Clearing $var from host file." | |
ssh-keygen -f "$HOME/.ssh/known_hosts" -R $var | |
echo "Key scanning $var" | |
ssh-keyscan $var >> ~/.ssh/known_hosts | |
done |
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
ansible -i ~/ansible/hosts -m authorized_key -a "key='{{ lookup('file', '/home/YOURUSER/.ssh/id_rsa.pub') }}' user=YOURUSER" -u YOURUSER all -k |
OlderNewer