Skip to content

Instantly share code, notes, and snippets.

View ckirsch's full-sized avatar

Christoph Kirsch ckirsch

View GitHub Profile
@ckirsch
ckirsch / pr.md
Created September 10, 2016 09:05 — forked from piscisaureus/pr.md
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 = git@github.com: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:

@ckirsch
ckirsch / Build Script for Cross Compilers (xgcc)
Created August 19, 2013 03:13
This is a script for building gcc cross compilers.
# Building xgcc for C:
# On a mac install the latest gcc binaries via macports.org:
sudo port install gcc48
port select --list gcc
sudo port select --set gcc mp-gcc48
hash -r
# Building xgcc:
@ckirsch
ckirsch / C Makefile for Shared Libraries
Last active December 20, 2015 22:38
This is a makefile for compiling C programs that implement shared libraries. It also serves as example for compiling regular C programs.
# This is for C but can easily be modified to work for other languages as well
CC = gcc
# Object files go into $(OBJDIR), executables go into $DISTDIR
OBJDIR = build
DISTDIR = dist
# Uncomment next line to overwrite standard malloc library
# WRAP = -Wl,--wrap=malloc -Wl,--wrap=free -Wl,--wrap=calloc -Wl,--wrap=realloc -Wl,--wrap=malloc_usable_size
@ckirsch
ckirsch / Reduce File Size Medium Quality 150dpi.qfilter
Created August 11, 2013 18:13
Putting this file into /Library/PDF Services/ on a Mac OS 10.8 system will provide a new option in the Preview app for exporting PDFs at reduced file size but with still acceptable quality.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Domains</key>
<dict>
<key>Applications</key>
<true/>
<key>Printing</key>
<true/>
@ckirsch
ckirsch / .gitconfig
Created March 25, 2013 15:05
My .gitconfig file
[user]
name = Christoph Kirsch
email = ***
[core]
editor = subl -w
autocrlf = input
safecrlf = warn
[merge]
tool = vimdiff
[alias]
@ckirsch
ckirsch / gpgmulti
Last active October 21, 2022 12:33
Symmetrically encrypt multiple files with GnuPG
#!/bin/bash
###############################################################################
## name : gpgmulti.sh (original by Nick Montpetit)
## purpose : symmetrically encrypts/decrypts multiple files using GnuPG
## usage : gpgmulti.sh [-c] file_pattern
###############################################################################
# encrypt all non-gpg files recursively:
# find . -type f -not -name .DS_Store -not -name "*.gpg" -print0 | xargs -0 -o gpgmulti.sh -c
@ckirsch
ckirsch / Mac .profile Bash Script
Last active February 22, 2016 14:12
Mac .profile bash script managing MacPorts, MacTeX, Sublime, and git.
# Mac OS X bash ~/.profile
# MacPorts Installer adding an appropriate PATH variable for use with MacPorts.
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.
# Use MacTeX rather than MacPorts for TeX
export PATH=/usr/texbin:$PATH
# Find my scripts
@ckirsch
ckirsch / Subcaptions
Created March 1, 2013 05:30
Multiple subfigures in LaTeX using the subcaption package.
...
\usepackage{subcaption}
...
\begin{figure}
\begin{center}
\begin{subfigure}[t]{0.48\textwidth}
\centering
\includegraphics[width=0.38\textwidth]{image-a}
\caption{Subfigure A caption}
\label{fig:image-a}
@ckirsch
ckirsch / LaTeX Makefile
Created March 1, 2013 05:17
Makefile for LaTeX'ing and Bibtex'ing papers that may include xfig'ures. Supports pdflatex as well as latex, dvips, and epstopdf.
##########################################################################
# LaTeX Makefile by Christoph Kirsch
#
# Do not remove any tab characters.
# Tab characters distinguish dependencies from commands.
##########################################################################
# Define the main file that includes all others and the bib file
# In local make script, define, e.g., 'export MAIN=other' to overwrite default
MAIN := paper