Skip to content

Instantly share code, notes, and snippets.

File 1:
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
sed 's/ / | /g' 1 > 2
File 2:
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
sed 's/^/| /' 2 > 3
File 3:
| 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
sed 's/$/ |/' 3 > 4
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 |
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
@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:
@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 / 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 / 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 / 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`