This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(doc, req) { | |
// bind zone file generation as an example (CouchDB show function) | |
// see http://blog.fupps.com/2010/05/03/dns-backed-by-couchdb-redux/ | |
// reused some code by the original author Jan-Piet Mens | |
// Warning very raw code below. It may eat your pants. | |
var soa_rr = function (mname, rname, serial, refresh, retry, expire, minimum){ | |
return ("@ IN SOA " + mname + ". " + rname + ". ("+ serial+" "+ refresh + " "+ retry + " "+ expire +" "+ minimum +")\n\n"); | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Section "InputClass" | |
Identifier "Enable two finger scroll for synaptics touchpad" | |
MatchProduct "SynPS/2 Synaptics TouchPad" | |
MatchDevicePath "/dev/input/event10" | |
Option "VertTwoFingerScroll" "on" | |
Option "EmulateTwoFingerMinW" "8" | |
Option "EmulateTwoFingerMinZ" "40" | |
Option "SHMConfig" "on" | |
EndSection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.shuffle = function () { | |
var randomIndex, temp, i = this.length; | |
while (--i) { | |
randomIndex = Math.floor(i * Math.random()); | |
if (randomIndex !== i) { | |
temp = this[i]; | |
this[i] = this[randomIndex]; | |
this[randomIndex] = temp; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GIT="/usr/bin/git" | |
CVS_MODULE_BASE="BASEPATH/" | |
if [ -d .git ] ; then | |
if [ `git config --get cvsimport.module` ] ; then | |
echo "Good! Using the short cvsimport method" | |
${GIT} cvsimport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Benchmark qw(:all); | |
use Benchmark ':hireswallclock'; | |
my %special_tariffs = (1166 => 1, 1390 => 1, | |
1229 => 1, | |
1412 => 1, 1413 => 1 | |
); | |
my $b; | |
my $count = 10000000; | |
$b = timethese($count, {t1 => \&fun1}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
REPPATH="/home/user/git/localgitrepository" | |
DEPLOYTARGET="/var/www/sites/mydomain" | |
LIVEURL="http://mydeploydomain.tld" | |
if [ -d ${REPPATH} ] ; then | |
cd "${REPPATH}" | |
git pull | |
jekyll --url "${LIVEURL}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package receivehook; | |
use Dancer ':syntax'; | |
our $VERSION = '0.3'; | |
# Configuration for different projects | |
my $config = { | |
"PROJECTNAME" => { | |
run => "/home/user/bin/updateblog.sh", | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Helper to relocate git-svn urls. | |
OLD_REPO=`git config --local --get svn-remote.svn.url` | |
if [[ $1 ]] ; then | |
NEW_REPO=$1 | |
else | |
NEW_REPO='https://defaultrepourl/lalal/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Remove old docker containers | |
docker rm $(docker ps --no-trunc -aq) | |
# Remove unreferenced images | |
docker images | grep "<none>" | awk '{print $3}' | xargs docker rmi | |
#OR | |
#alias dockercleancontainers="docker ps -a -notrunc| grep 'Exit' | awk '{print \$1}' | xargs -L 1 -r docker rm" |
OlderNewer