Skip to content

Instantly share code, notes, and snippets.

View azatoth's full-sized avatar

Carl Fürstenberg azatoth

  • Purple Scout AB
  • Malmö
View GitHub Profile
@azatoth
azatoth / diskdaemon.pl
Created November 25, 2011 15:16
Current diskdaemon.pl
#!/usr/bin/perl -w
use strict;
use v5.10;
use Proc::Daemon;
use Sys::Syslog;
@azatoth
azatoth / multiline echo
Created June 16, 2011 19:50
echo static multi line data in makefile
define data
foo
bar
baz
endef
export data
all:
@echo "$$data"
@azatoth
azatoth / xvim
Created May 11, 2011 09:44
Open gvim in same window when on same "desktop"
#!/bin/bash
this=$(basename $0); # vim|gvim|rvim etc...
desktop=desktop_$(xprop -root -notype _NET_CURRENT_DESKTOP | perl -pe 's/.*?= (\d+)/$1/')
number_desktop=$(xprop -root -notype _NET_NUMBER_OF_DESKTOPS | perl -pe 's/.*?= (\d+)/$1/')
viewport=viewport_$(xprop -root -notype _NET_DESKTOP_VIEWPORT | perl -pe 's/.*?= (\d+), (\d+)/$1x$2/')
if [ $number_desktop = 1 ]; then
desktop=$viewport;
fi
@azatoth
azatoth / mw_ext_split.sh
Created March 10, 2011 22:52
Splits the github mediawiki extension copy repository into one repo per extension
#!/bin/bash
# This script takes the mediawiki trunk extension git repository and splits them into one
# repository for each extension
#
# Warning: this can take some time
#
# Specify the path to your copy of the extension repo below:
MW_EXT_GIT=$HOME/public_html/mediawiki-trunk-extensions
#!/bin/sh
# mostly default pre-commit hook
if git-rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
fi
if [ "$allowjsconsole" != "true" ]; then
jsfiles=$(git diff --cached --name-only --relative $against | sed -n '/\.js$/p');
if [ -n "$jsfiles" ] &&
[ -n "$( git diff --cached -Sconsole. $jsfiles | sed -n 's/console\.\(\w\+\)(.*\?)/&/p')" ];
then
echo "Error: Attempt to commit javascript with js console usage."
echo
echo "This might upset the master people..."
echo
echo "if you don't care about their wishes, you can disable"