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
#!/usr/bin/perl
use strict;
use warnings;
use v5.18;
use Config::General;
use File::Find::Wanted;
use File::Slurp;
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"
#!/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
@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
@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 / pexconvert.pl
Created August 11, 2012 18:10
convert Minecraft Bukkit PermissionEX PEX SQL to flat file format
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
use YAML::Tiny;
my $permissions = {
'users' => {},
[All-Projects]
checkout = git clone 'https://gerrit.wikimedia.org/r/All-Projects' 'All-Projects'
[USERINFO]
checkout = git clone 'https://gerrit.wikimedia.org/r/USERINFO' 'USERINFO'
[VisualEditor]
checkout = git clone 'https://gerrit.wikimedia.org/r/VisualEditor' 'VisualEditor'
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(__git_ps1 " «%s»")\$ '
GIT_PS1_SHOWDIRTYSTATE=1
GIT_PS1_SHOWSTASHSTATE=1
GIT_PS1_SHOWUNTRACKEDFILES=1
GIT_PS1_SHOWUPSTREAM="git verbose"
@azatoth
azatoth / BlockRecyclerBlock.java
Created January 5, 2014 19:54
Trial to make a IC2 addon (code layout idea borrowed from Advanced Machines)
package azatoth.mc.recycler;
import ic2.api.item.Items;
import azatoth.mc.recycler.client.ClientProxy;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
var path = require('path');
var Q = require('q');
Q.longStackSupport = true;
module.exports = function (Content) {
Content.observe('before save', (ctx, next) => {
function getOldContent(name, pathId, counter, cb) {
var parsed = path.parse(name);
var filename = counter === 1 ? name : `${parsed.name} (${counter})${parsed.ext}`;