Skip to content

Instantly share code, notes, and snippets.

View gnuhub's full-sized avatar
🎯
Focusing

gnuhub gnuhub

🎯
Focusing
  • Mars
View GitHub Profile
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
@jbenet
jbenet / current_utc_time.c
Created July 17, 2011 16:17
work around lack of clock_gettime in os x
/*
author: jbenet
os x, compile with: gcc -o testo test.c
linux, compile with: gcc -o testo test.c -lrt
*/
#include <time.h>
#include <sys/time.h>
#include <stdio.h>
@fujin
fujin / foo.rb
Created January 31, 2012 21:49
template override between cookbooks
template "/tmp/foo.rb"
source "foo.rb.erb"
cookbook "banana"
end
@DamienCassou
DamienCassou / update-emacs-ppa.sh
Last active February 20, 2016 21:26
Emacs-snapshot and emacs24 build script for Ubuntu PPA
#! /usr/bin/env bash
# Author: Damien Cassou
#
# This is the script I use to build Emacs packages for Ubuntu. These
# packages are uploaded to
# https://launchpad.net/~cassou/+archive/emacs/. Each package is
# either build from a Debian package or from
# http://emacs.naquadah.org/.
@isao
isao / git-pullrequest.sh
Created June 6, 2012 17:57 — forked from CyberShadow/git-pullrequest.sh
Easy GitHub pull requests
#!/bin/bash -e
# based on Vladimir Panteleev's https://gist.github.com/1885859
die() {
echo "$@" >&2
exit 1
}
branch=$(git name-rev --name-only HEAD 2>/dev/null)
ghusr=$(git config --get github.user)
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = [email protected]:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ecarreras
ecarreras / pr.md
Created September 17, 2012 09:50 — forked from kennethreitz/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

Now add this lines:

[remote "github"]
	url = [email protected]:joyent/node.git
	fetch = +refs/pull/*/head:refs/remotes/github/pr/*
Locate the section for your github remote in the `.git/config` file. It looks like this:
```
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
```
Now add the line `fetch = +refs/pull/*/head:refs/remotes/origin/pr/*` to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
@lukewpatterson
lukewpatterson / gist:6491377
Last active January 27, 2016 08:19
db2 in docker
FROM base
RUN echo "deb http://archive.canonical.com/ubuntu precise partner" >> /etc/apt/sources.list
RUN echo "deb-src http://archive.canonical.com/ubuntu precise partner" >> /etc/apt/sources.list
RUN echo "deb http://archive.ubuntu.com/ubuntu precise universe" >> /etc/apt/sources.list
RUN echo "deb-src http://archive.ubuntu.com/ubuntu precise universe" >> /etc/apt/sources.list
RUN apt-get update
RUN apt-get --yes install ksh
@timsutton
timsutton / issues.txt
Created February 24, 2014 19:44
Start of a VirtualBox OS X Packer template.
Two main issues:
1) Packer currently always uses an IDE storage controller, but in VBox only a SATA DVD image seems to be useful to boot the installer.
2) The disk device in the guest shows up as removable drive rather than an internal SATA, and this seems to confuse AutoPartition.app and make it not see a drive to partition. I'm not sure if there are some options that could be passed to AutoPartition to make it see the drive as partition-able. This is just one more reason why switching to some auto-partitioning shell code in /etc/rc.common might be better off than relying on AutoPartition.