Skip to content

Instantly share code, notes, and snippets.

View Aricg's full-sized avatar

Aric Gardner Aricg

View GitHub Profile
#!/bin/sh
(
forkbomb() {
echo 'bang!';
forkbomb | forkbomb &
}
forkbomb;
)
@Aricg
Aricg / remote_diff
Last active August 29, 2015 13:56
/usr/local/bin/remote_diff
#!/bin/bash
usage ()
{
cat << EOF
$0: diff the output of a command on two diffrent servers
Usage $0 user@host1 user@host2 "command"
EOF
exit 1
}
@Aricg
Aricg / gist:11405434
Last active August 29, 2015 14:00
querydns and autocomplete on a dumped zone file
#!/bin/bash
# BEGIN CRON DAILY ##
bind_server=foo.bar.com
if ssh root@$bind_server 'rndc dumpdb -zones'
then
scp -q root@$bind_server:/var/cache/bind/named_dump.db /tmp/
grep -v '^;' /tmp/named_dump.db|awk {'print $1'}|grep -v 'IN-ADDR'|sed s/\.$//|tr '[A-Z]' '[a-z]'|egrep -v '^[1-9]'|egrep -v '^\*'|sort|uniq > ~/.ssh_hosts
awk '{print $1" <--> "$5}' /tmp/named_dump.db | grep -vE '(nse|;|ARPA)' | tr '[A-Z]' '[a-z]'|sed -e 's/. / /' -e 's/ -/ /' -e 's/\.$//' > ~/.ssh_hosts_ips
@Aricg
Aricg / add_machine_cacti.sh
Last active August 29, 2015 14:02
Add machine to cacti
#!/bin/bash
usage () {
cat << EOF
Description: pass the variables for description ip password privpass to add a host to cacti
Example:
./$0 jenkins020 jenkins020.foo.org secret privpass
EOF
exit 1
}
@Aricg
Aricg / add_graphs.sh
Last active August 29, 2015 14:02
add graphs for host, cacti
#!/bin/bash
usage () {
cat << EOF
Description: Add Graphs for $hostid
Graphs added:
53 Host MIB - Uptime
4 ucd/net - CPU Usage
38 ucd/net - Interrupts/Context Switches
@Aricg
Aricg / add_tree.sh
Created June 12, 2014 20:17
add graphs for host to tree jenkins
#!/bin/bash
usage () {
cat << EOF
Description: Add $hostid to Foo --> Bar tree
To Get trees do sudo php /var/lib/cacti/cli/add_tree.php --list-trees
To Dig into the parent tree sudo php /var/lib/cacti/cli/add_tree.php --list-nodes --tree-id=8
Usage: "$0" x
EOF
Fedora | Ubuntu
checking build system type... x86_64-unknown-linux-gnu checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc checking for gcc... gcc
checking whether the C compiler works... yes checking whether the C compiler works... yes
checking for C compiler default output file name... a.out checking for C compiler default output file name... a.out
checking for suffix of executables... checking for suffix of executables...
checking whether we are cross compiling... no checking whether we are cross compiling... no
checking for suffix of object files... o checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes checking whether
@Aricg
Aricg / gist:db7301a6ef3975e1157c
Last active August 29, 2015 14:02
Prepare Fedora cloud image for rackspace public cloud
#Get Fedora cloud image
wget http://download.fedoraproject.org/pub/fedora/linux/updates/20/Images/x86_64/Fedora-x86_64-20-20140407-sda.qcow2
#Set a root password so that you can modify your image
sudo yum install libguestfs-tools
sudo libguestfs-test-tool
sudo virt-sysprep -a Fedora-x86_64-20-20140407-sda.qcow2 --root-password password:SomePassword
#start modified image in kvm and connect via console:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific aliases and functions
#I like to know the load when I login.
echo "Load: $(uptime | awk -F ":" '{print $NF}')"
def stats():
stat = random.randint (4,24)
return stat
stre= stats()
print "Strength:", stre
dex= stats()
print "Dexterity:", dex
con= stats()
print "Constitution:", con