Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am shamangeorge on github.
  • I am shamangeorge (https://keybase.io/shamangeorge) on keybase.
  • I have a public key whose fingerprint is 4DDC E17F 4BBB F17A 2238 5FBF 543D C658 ABC5 A3F2

To claim this, I am signing this object:

@shamangeorge
shamangeorge / vpnsetup.sh
Last active August 29, 2015 14:15 — forked from hwdsl2/.MOVED.md
#!/bin/sh
#
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN
# on a Ubuntu server instance. Tested with 14.04 (Trusty) AND 12.04 (Precise).
# With minor modifications, this script *can also be used* on dedicated servers
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers.
#
# DO NOT RUN THIS SCRIPT ON YOUR PC OR MAC! THIS IS MEANT TO BE RUN WHEN
# YOUR AMAZON EC2 INSTANCE STARTS!
#
#!/bin/sh
exec < /dev/tty
./.git/hooks/validate_commit.rb $1
@shamangeorge
shamangeorge / index.html
Last active October 5, 2015 23:02
html5 video tests
<body>
<video id="sample" src="" controls="true"></video>
<video id="sample2" src="" controls="true"></video>
<script>
var videos = [
document.getElementById('sample'),
document.getElementById('sample2')
];
initHandler(0);
#!/bin/bash
/opt/vhl/ffmpeg/bin/ffmpeg -i audio.in -ac 1 -acodec pcm_s16le -ar 16000 audio.out
@shamangeorge
shamangeorge / devicemotion.css
Last active December 17, 2015 22:59
Device Motion events Javascript
#deviceMotionVariables {
text-align: justify;
width: 200px;
border: 5px solid black;
position: absolute;
right: 10%;
top: 5%;
display: none;
}
@shamangeorge
shamangeorge / backup
Created July 21, 2013 17:47
basic archive rotation backup script
#!/bin/bash
####################################
#
# Backup to NFS mount script with
# grandfather-father-son rotation.
#
####################################
# What to backup.
backup_files="/home /var/www /var/spool/mail /etc /root /boot /opt"
@shamangeorge
shamangeorge / get_vagrants.sh
Last active December 25, 2015 04:09
Get all vagrants
for url in `curl http://www.vagrantbox.es | grep '<td>h' | sed 's/<th scope="row">//g' | sed 's/<\/td>//g' | sed 's/<td>//g' | sed '/goo.gl/d' | sed 's/\ //g'`; do file=`echo $url | sed 's/\ //g' | sed 's/\///g' | sed 's/disk1//g' | sed 's/http\://g' | sed 's/https\://g'`; vagrant box add $file $url; done;
@shamangeorge
shamangeorge / findgitconfigs.sh
Created October 16, 2013 15:19
find all gitconfigs in dir and subdirs
dir = 1$
for gitconfig in `find $dir -wholename "*.git/config" -type f`;do nano "$gitconfig"; done
@shamangeorge
shamangeorge / regexp.sh
Last active December 25, 2015 23:29
Useful bash regexp methods
egrep -o '([0-9]{1,3}\.){3}[0-9]{1,3}' # finds ips in a file
# From http://stackoverflow.com/questions/1444406/how-can-i-delete-duplicate-lines-in-a-file-in-unix/1444448#1444448
# delete duplicate, consecutive lines from a file (emulates "uniq").
# First line in a set of duplicate lines is kept, rest are deleted.
sed '$!N; /^\(.*\)\n\1$/!P; D'
# delete duplicate, nonconsecutive lines from a file. Beware not to
# overflow the buffer size of the hold space, or else use GNU sed.
sed -n 'G; s/\n/&&/; /^\([ -~]*\n\).*\n\1/d; s/\n//; h; P'