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/env bash | |
# | |
# because sometimes a server sporadically acts funny and we're all like wtf. | |
# date and -+ separated list of general os, system, and network stuff. | |
echo -e "#!/usr/bin/env bash\n(date; top -n1; ps axfu; iostat; vmstat; df -h; lsof -n -i; netstat -ano; w; echo -e '\n-----------------\n\n') >> /var/log/wtf.log" > /root/wtf.sh | |
chmod +x /root/wtf.sh | |
# put it in the crontab. | |
echo '* * * * * /root/wtf.sh' >> /var/spool/cron/crontabs/root |
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
const int LED = 3; | |
void setup() | |
{ | |
pinMode(LED, OUTPUT); | |
} | |
void loop() | |
{ |
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
│~/bin/readis_safe (master) > redis-cli | |
│redis 127.0.0.1:6379> redis-cli rpush list1 one two three four five six | |
│(error) ERR unknown command 'redis-cli' | |
│redis 127.0.0.1:6379> rpush list1 one two three four five six | |
│(integer) 6 | |
│redis 127.0. |
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
[14] pry(main)> cd a | |
[15] pry(#<Fog::Compute::AWS::Server>):1> ls | |
Fog::Attributes::InstanceMethods#methods: _dump attributes dup identity identity= merge_attributes new_record? requires requires_one | |
Fog::Model#methods: collection collection= connection connection= inspect reload symbolize_keys to_json wait_for | |
Fog::Compute::Server#methods: scp scp_download scp_upload ssh ssh_port sshable? | |
Fog::Compute::AWS::Server#methods: addresses ami_launch_index ami_launch_index= architecture architecture= availability_zone availability_zone= block_device_mapping block_device_mapping= client_token client_token= console_output created_at created_at= destroy dns_name dns_name= flavor flavor= flavor_id flavor_id= groups groups= iam_instance_profile iam_instance_profile= iam_instance_profile_arn= iam_instance_profile_name= id id= image_id image_id= instance_initiated_shutdown_behavior instance_initiated_shutdown_behavior= ip_address kernel_id kernel_id= key_name key_na |
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/env bash | |
# On a new / clean installation of debian squeeze | |
# Install Ruby from source | |
# Create a Debian package using FPM | |
# Update apt | |
apt-get update -y |
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/env bash | |
# Add 10gen Debian repository to apt sources | |
apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10 | |
echo -e "\n# 10gen\ndeb http://downloads-distro.mongodb.org/repo/debian-sysvinit\tdist 10gen" >> /etc/apt/sources.list | |
apt-get update -y | |
# Install misc packages | |
apt-get install -y vim tmux psmisc |
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/env ruby | |
puts RUBY_VERSION | |
# puts the ruby load path | |
puts $: | |
Object.constants.sort.each {|c| cv=Object.const_get(c); print c, "=", cv, "\n" unless Module === cv} |
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/env bash | |
# Target OS: Debian | |
# Install rbenv, ruby-build, ruby | |
# Update, upgrade and install development tools: | |
apt-get -qy update | |
apt-get -qy upgrade | |
apt-get -qy install build-essential git-core curl libssl-dev \ | |
libreadline5 libreadline5-dev \ |
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/env bash | |
# Target OS: Debian | |
# Install Cassandra 1.1.x | |
sh -c 'echo deb http://www.apache.org/dist/cassandra/debian 11x main >> /etc/apt/sources.list.d/cassandra-stable.list' | |
sh -c 'echo deb-src http://www.apache.org/dist/cassandra/debian 11x main >> /etc/apt/sources.list.d/cassandra-stable.list' | |
gpg --keyserver keyserver.ubuntu.com --recv-keys 4BD736A82B5C1B00 | |
gpg --export --armor 4BD736A82B5C1B00 | apt-key add - |
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/env bash | |
set -x | |
ps axfu | grep -iE 'ruby|java|node|redis|mongo|cassandra' | |
/etc/init.d/redis-server stop | |
/etc/init.d/mongodb stop | |
/etc/init.d/cassandra stop | |
rm -rf /var/lib/cassandra/* |