Skip to content

Instantly share code, notes, and snippets.

View Aricg's full-sized avatar

Aric Gardner Aricg

View GitHub Profile
@Aricg
Aricg / gist:781b85a89409a666148e
Created August 8, 2014 17:23
Docker Arp issues?
Ping from my docker image. first it doesnt work, then it does.
root@2ed081d6465f:/# ping 192.168.0.106
PING 192.168.0.106 (192.168.0.106) 56(84) bytes of data.
From 192.168.0.6 icmp_seq=1 Destination Host Unreachable
##
# 192.168.0.6 is not even a machine on the network!
##
^C
#Chooses a Race and changes the stats according to the race chosen
print "What race would you like to play as?\n 1: Human \n 2: Dwarf \n 3: Elf \n 4: Gnome \n 5: Half-Elf \n 6: Half-Orc \n 7: Halfling"
race = int(raw_input())
if (race == 1):
print "Hello Human."
racename = "Human"
elif (race == 2):
print "Hello, Dwarf."
def stats():
stat = random.randint (4,24)
return stat
stre= stats()
print "Strength:", stre
dex= stats()
print "Dexterity:", dex
con= stats()
print "Constitution:", con
# .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}')"
@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:
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 / 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
@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_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 / 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