Skip to content

Instantly share code, notes, and snippets.

@eldondev
eldondev / cmd
Last active December 4, 2023 16:33
Because everyone needs a good preseed
wget -nc http://ftp.debian.org/debian/dists/jessie/main/installer-amd64/current/images/netboot/debian-installer/amd64/linux
wget -nc http://ftp.debian.org/debian/dists/jessie/main/installer-amd64/current/images/netboot/debian-installer/amd64/initrd.gz
cp -nv ~/.ssh/id_rsa.pub .
qemu-system-x86_64 -machine accel=kvm -kernel linux -initrd initrd.gz -m 1G -smp 2 -append "blacklist=vga16fb fb=false video=false vga=normal auto=true url=http://10.0.2.10:8080/debian-preseed.txt hostname=otto domain=" -net user,guestfwd=:10.0.2.10:8080-cmd:"/bin/busybox httpd -i" -hda /dev/shm/deb.img -net nic -display none
- name: install ntp
yum: pkg=ntp state=installed
- name: check ntpd service is stopped
shell: "service ntpd status | grep -q stopped; echo $?"
register: result
- name: ntpdate
command: ntpdate 0.uk.pool.ntp.org
when: result.stdout == "0"
- name: ntp config file
template: src=roles/common/templates/ntp.conf.j2 dest=/etc/ntp.conf owner=root group=root mode=0644
#!/usr/bin/python
try:
import boto.ec2
except ImportError:
print "failed=True msg='boto required for this module'"
sys.exit(1)
def main():
argument_spec = ec2_argument_spec()
@haad
haad / rails app upstart init script
Last active December 23, 2015 11:09
Run rails application from upstart with start-stop-daemon
description "Rails Application"
start on runlevel [2345]
stop on runlevel [!2345]
console log
respawn
chdir /srv/apps/rails_path/current
env APP_NAME="rails-app"
@haad
haad / gist:3101483
Created July 12, 2012 22:25
Folder processing algorithm
#!/usr/bin/env ruby
folders = [
["chsys-wiki/Customers/3070/servers/3070_server.asciidoc", 3],
["chsys-wiki/Customers/Ait/servers/ait_firewall.asciidoc", 4],
["chsys-wiki/Customers/Blumenbecker/servers/server_fileserver.asciidoc", 5],
["chsys-wiki/Customers/Blumenbecker/servers/server_firewall.asciidoc", 6],
@haad
haad / gist:2584378
Created May 3, 2012 08:29
Find a server-name in a list of created devices on VIO server and print it's vhost
/usr/ios/cli/ioscli lsmap -all | egrep 'VTD|vhost' | perl -e 'my $old; while (my $line = <STDIN> ) { if ($line =~ /server-name/) { print "$old$line"; next; } $old = $line; }'
/usr/ios/cli/ioscli lsmap -all | egrep 'VTD|vhost' | awk '$0 ~= /server-name/ {print $0" "old;} {old=$0;}'
/usr/ios/cli/ioscli lsmap -all | egrep 'VTD|vhost' | awk '/server-name/{print old"\n "$0;} /vhost/{old=$0;}'
@haad
haad / gist:2584354
Created May 3, 2012 08:26
convert mask variable in hex notation to dotted notation in plain ksh
mask=$(echo $a | sed 's/^0x//g;s/\(..\)/\1\,/g;s/,$//g;'| tr ',' '\n' | while read w; do printf ".%d" 0x$w; done|sed -e 's/^\.//');echo "Netmask $a converted to dotted notation is $mask";
@danielsand
danielsand / proxychains-3.1_osx.diff
Created October 27, 2011 12:48
Proxychains 3.1 MacOS X Homebrew Patch
diff -ruN proxychains-3.1/proxychains/Makefile.in proxychains-3.1_resolv/proxychains/Makefile.in
--- proxychains-3.1/proxychains/Makefile.in 2006-03-15 10:16:59.000000000 -0600
+++ proxychains-3.1_resolv/proxychains/Makefile.in 2011-06-16 13:17:20.000000000 -0500
@@ -121,7 +121,7 @@
LIBS = @LIBS@
libproxychains_la_DEPENDENCIES =
libproxychains_la_OBJECTS = libproxychains.lo core.lo
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ -arch x86_64 -arch i386
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)