Skip to content

Instantly share code, notes, and snippets.

@doubleotoo
doubleotoo / README.md
Created March 20, 2012 00:02
Markdown examples

Github:flavored:markdown

def initialize
  puts "Hello, World!"
end
@doubleotoo
doubleotoo / install.sh
Created April 12, 2012 19:15
j2dotcom-gollum-github-wiki
$ [sudo] gem install gollum
@doubleotoo
doubleotoo / christ.txt
Created May 10, 2012 18:33 — forked from natlownes/christ.txt
git pre-receive hook to catch Ruby debugger statements and reject push
.======.
| INRI |
| |
| |
.========' '========.
| _ xxxx _ |
| /_;-.__ / _\ _.-;_\ |
| `-._`'`_/'`.-' |
'========.`\ /`========'
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
@doubleotoo
doubleotoo / build_gcc_4.7_on_mac.sh
Created June 13, 2012 22:57 — forked from mtholder/build_gcc_4.7_on_mac.sh
Script to download and build gcc 4.7 and its dependencies on mac - it took about 40 minutes on my machine (and the "make check" in the gcc build failed for lack of an "autogen" script"), but the compiler seems to work.
#!/bin/sh
# You might want to modify the first line to specify your own install location.
# In theory the rest should not need tweaking...
export GCC_PREFIX="$HOME/gcc4.7"
# Hopefully, you can tweak these as they get out of date, but the download URL's
# may not be stable to text substitution.
GMP_DOWNLOAD_VERSION=gmp-5.0.5
MPFR_DOWNLOAD_VERSION=mpfr-3.1.0
MPC_DOWNLOAD_VERSION=mpc-0.8.2
@doubleotoo
doubleotoo / patch-net_http.rb
Created October 23, 2012 22:33
Faraday: Disable SSL verification
# See project page: https://github.com/technoweenie/faraday
#
# This patch applies to:
#
# faraday (0.8.4)
# faraday_middleware (0.8.8)
require 'faraday'
module Faraday
class Adapter
@doubleotoo
doubleotoo / install-gcc.sh
Last active October 12, 2015 02:08
GCC installation script (with pre-installed prerequisites)
#!/bin/bash -e
#-------------------------------------------------------------------------------
# Default values
#-------------------------------------------------------------------------------
: ${GCC_VERSION:=$1}
: ${LANGUAGES:=c,c++,fortran}
: ${MPFR_HOME:=}
: ${GMP_HOME:=}
: ${MPC_HOME:=}
@doubleotoo
doubleotoo / autotools-bootstrap-basic.sh
Created November 14, 2012 23:54
A basic script for project setup with the GNU autotools
#! /bin/bash
#
# Copied from http://code.google.com/p/autotools-bootstrap/source/browse/autotools-bootstrap-basic.sh
#
# This is the basic script for project setup with the GNU autotools.
# Visit:
# http://seth-g-kriticos.blogspot.com/2008/06/how-to-set-up-open-source-c-development.html
# to find out, what it does.
echo "Please enter the project name: "
@doubleotoo
doubleotoo / timeout.sh
Created November 16, 2012 18:24
Execute a shell command with a timeout
#!/bin/sh
# Execute a command with a timeout
# Author:
# http://www.pixelbeat.org/
# Notes:
# Note there is a timeout command packaged with coreutils since v7.0
# If the timeout occurs the exit status is 124.
# There is an asynchronous (and buggy) equivalent of this
@doubleotoo
doubleotoo / install-hpctoolkit.sh
Created November 19, 2012 17:45
Quick and dirty script to automate the installation of HPCToolkit
#!/bin/bash
#
# Usage: [HPCTOOLKIT_HOME=/path/for/hpctoolkit/home] ./install-hpctoolkit.sh
#
# Environment Variables
#
# HPCTOOLKIT_HOME (Optional) To specify a location to build and
# install the HPCToolkit software.
# Default: $HOME/opt/hpctoolkit