Skip to content

Instantly share code, notes, and snippets.

@lancelakey
lancelakey / wtflog.sh
Created March 14, 2012 21:34 — forked from flores/wtflog.sh
for sporadic wtfs.
#!/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
@lancelakey
lancelakey / gist:2321570
Created April 6, 2012 17:38
arduino pulse LED
const int LED = 3;
void setup()
{
pinMode(LED, OUTPUT);
}
void loop()
{
│~/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.
[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
@lancelakey
lancelakey / create_ruby_debian_package.sh
Created September 16, 2012 01:40
Create Ruby 1.9.3-rc1 Debian package using FPM
#!/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
@lancelakey
lancelakey / install_mongodb-10gen.sh
Created September 28, 2012 02:57
Install MongoDB onto Debian from 10gen Repository
#!/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
@lancelakey
lancelakey / ruby_puts_version.rb
Created October 3, 2012 22:30
Ruby put ruby version and loadpath
#!/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}
@lancelakey
lancelakey / install_rbenv.sh
Created October 4, 2012 08:55
Debian install rbenv, ruby-build, ruby
#!/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 \
@lancelakey
lancelakey / install_cassandra.sh
Created October 5, 2012 07:46
Debian install Cassandra 1.1.x
#!/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 -
#!/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/*