Skip to content

Instantly share code, notes, and snippets.

View stigkj's full-sized avatar

Stig Kleppe-Jørgensen stigkj

View GitHub Profile
@henrik
henrik / commit-msg
Created September 10, 2009 18:25
Git commit-msg hook that automatically adds "Refs #123" when in the branch t123, "[#123]" when in the branch s123 etc.
#!/usr/bin/env ruby
#
# Git commit-msg hook. If your branch name is in the form "t123", automatically
# adds "Refs #123." to commit messages unless they mention "#123" already.
# Include "#close" or "#finish" to add "Closes #123."
#
# For Pivotal Tracker, branch names like "s123" adds "[#123]".
# Include "#close" or "#finish" to add "[Finishes #123]".
#
# If you include "#noref" in the commit message, nothing will be added to
@stigkj
stigkj / gist:548986
Created August 25, 2010 06:50
Nice Groovy script for Hudson that checks which jobs are building or in the queue (got this from http://adrian.org.ar/ci/concurrency-in-hudson)
//Jobs currently building or in the queue
jobs = hudson.model.Hudson.instance.items.findAll{job -> job.isBuilding()} + hudson.model.Hudson.instance.items.findAll{job -> job.isInQueue()}
//Keep only the names from the collected job objects
jobs = jobs.collect{x -> x.name}
//get current job name
currentJob = Thread.currentThread().executable.toString().split()[0]
//cut current job from the jobs list
@fbuchinger
fbuchinger / .picasa.ini
Created July 9, 2011 18:26
.picasa.ini decoded
#==============================================================
# .picasa.ini FILE STRUCTURE
#
# reverse-engineered by Franz Buchinger <[email protected]>
# licensed to the public domain
#
# Picasa Version(s): 3.8.0
#
# Changelog:
# v0.1: initial release
@stigkj
stigkj / git-fix-author
Created December 9, 2011 11:13 — forked from leif81/git_fix_author
Written to change the unix name used for a cvs commit to a pretty git name for the user.Implementation borrowed from http://lists.freedesktop.org/archives/portland/2010-October.txtauthor-conv-file format (same format as git-cvsimport requires):
#!/bin/bash
#
# Changes author and committer name and email throughout the whole repository.
# Uses a file with the following format:
#
# [email protected]=John Doe <[email protected]>
# [email protected]=Jill Doe <[email protected]>
#
if [ ! -e "$1" ]
import org.gradle.api.DefaultTask
import org.gradle.api.Project
import org.gradle.api.plugins.BasePlugin
/**
* apply this plugin after doing all dependency and repo stuff. It will create two idea 'libraries' per subproject
* and add them to your .iml files
*
* Forked from https://gist.github.com/360092
*
@bradt
bradt / setup-dnsmasq-os-x-lion
Created March 11, 2012 20:23
Setting up dnsmasq for Local Web Development Testing on any Device
# Setting up dnsmasq for Local Web Development Testing on any Device
Please note, these instructions are for OS X Lion.
First, you need to get the IP address of your machine on your local network. In OS X, the easiest place to find this is in System Preferences > Network. If you're using DHCP on your local network, you will want to make sure your computer requests the same IP address when it renews it's IP address lease. I recommend configuring the DCHP Reservation settings on your router to accomplish this. Otherwise, you can specify a manual address in your network settings:
1. Go to *System Preferences > Network*
1. Click *Advanced...*
@michalbcz
michalbcz / gist:2757630
Created May 20, 2012 10:47
groovy - when you're missing collectWithIndex method...
List.metaClass.collectWithIndex = { yield ->
def collected = []
delegate.eachWithIndex { listItem, index ->
collected << yield(listItem, index)
}
return collected
}
assert [1, 1, 1, 1, 1].collectWithIndex { it, index -> it + index } == [1, 2, 3, 4, 5]
anonymous
anonymous / nrk-subtitles2srt.xsl
Created November 13, 2012 09:10
nrk download helper, run nrk.sh for usage
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ttml="http://www.w3.org/ns/ttml"
xmlns:tts="http://www.w3.org/2006/04/ttaf1#styling">
<xsl:output
method="text"
indent = "no"
encoding="UTF-8"/>
@jhickner
jhickner / reload_chrome.sh
Created November 15, 2012 22:37
Reload Chrome then refocus iTerm
#!/bin/sh
exec <"$0" || exit; read v; read v; exec /usr/bin/osascript - "$@"; exit
-- the above is some shell trickery that lets us write the rest of
-- the file in plain applescript
tell application "Google Chrome"
activate
tell application "System Events"
tell process "Google Chrome"
@aras-p
aras-p / preprocessor_fun.h
Last active November 15, 2024 09:22
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,