Skip to content

Instantly share code, notes, and snippets.

│~/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.
@lancelakey
lancelakey / gist:2321570
Created April 6, 2012 17:38
arduino pulse LED
const int LED = 3;
void setup()
{
pinMode(LED, OUTPUT);
}
void loop()
{
@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 / urltest.sh
Created November 3, 2011 05:24
Read a bunch of urls from a file, curl them all, echo the results
#!/usr/bin/env bash
#
# Script to read a bunch of urls from a file, curl them all, echo the results
# The original purpose of this script was to test a bunch of 302 redirects
TARGETS=`cat targets`
for i in $TARGETS
do
echo "Testing $i"
RESULT=`curl -s -L $i`
@lancelakey
lancelakey / sleepbot
Created October 5, 2011 22:07
Play Sleepbot Environmental Broadcast with mplayer
!#/usr/bin/env bash
#Sleepbot Environmental Broadcast
#sleepbot.com/ambience/broadcast/
#Peaceful streaming audio featuring a random cycling of some of the most sleep-worthy tracks ever created.
mplayer http://alpha.newerastreaming.com:8096
@lancelakey
lancelakey / interface_change
Created September 21, 2011 22:19
Change /etc/network/interfaces subnet
#!/usr/bin/env ruby
# Purpose
# Iterate over a range of IP addresses
# Change the /etc/network/interfaces subnet
# WARNING!
# I haven't tested this yet
# It might not work
@lancelakey
lancelakey / detect_duplicate_ip.sh
Created August 11, 2011 09:12
Detect or Find Duplicate IP Addresses
#!/usr/bin/env bash
# This script was written for and works on Mac OS X
# I have to use sudo to run arping on Mac OS X
# I believe the options for arping on linux are a little different. I believe you use -D for duplicate IP detection instead of -d but that's from memory and you should check.
echo "Starting duplicate IP detection with sudo arping!"
for i in {1..254};
do
sudo arping -q -d -c 2 192.168.1.$i; [ $? -ne 0 ] && echo "192.168.1.$i duplicate";
@lancelakey
lancelakey / check_arcconf.rb
Created April 14, 2011 00:02
Check the status of Adaptec RAID arrays and send email if everything isn't "Optimal"
Run this command
/usr/StorMan/arcconf GETCONFIG 1
Look for the below output.
Controller Status : Optimal
Status of logical device : Optimal
If any of these has a status other than optimal i.e. if status != optimal then email me ie. run this command:
ssed -i 's/ / | /g' 1| ssed -i 's/^/| /' 1| ssed -i 's/$/ |/' 1
File 1 (Before):
VLAN Name Subnet
1 Default 10.1.1.0/24
10 Ten 10.1.10.0/24
20 Twenty 10.1.20.0/24
30 Thirty 10.1.30.0/24
40 Fourty 10.1.40.0/24
50 Fifty 10.1.50.0/24
File 4:
| VLAN | Name | Subnet |
| 1 | Default | 10.1.1.0/24 |
| 10 | Ten | 10.1.10.0/24 |
| 20 | Twenty | 10.1.20.0/24 |
| 30 | Thirty | 10.1.30.0/24 |
| 40 | Fourty | 10.1.40.0/24 |
| 50 | Fifty | 10.1.50.0/24 |