Skip to content

Instantly share code, notes, and snippets.

View phdoerfler's full-sized avatar

Philipp Dörfler phdoerfler

View GitHub Profile
@DamienCassou
DamienCassou / configuration.nix
Created October 22, 2014 13:41
configuration.nix file for NixOS on my macbook pro
{ config, pkgs, ... }:
let
hostname = "luz3";
in {
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
# I use VirtualBox to connect to Windows and Linux guests
@chrisdarroch
chrisdarroch / idea
Created October 17, 2013 03:40
Open a project in IntelliJ IDEA from your command line!
#!/bin/sh
# check for where the latest version of IDEA is installed
IDEA=`ls -1d /Applications/IntelliJ\ * | tail -n1`
wd=`pwd`
# were we given a directory?
if [ -d "$1" ]; then
# echo "checking for things in the working dir given"
wd=`ls -1d "$1" | head -n1`
@mslinn
mslinn / sbtDeps
Created July 12, 2012 21:13
Shows all dependencies of an SBT project
#!/bin/bash
echo "Direct dependencies"
sbt 'show all-dependencies' | \
gawk 'match($0, /List\((.*)\)/, a) {print a[1]}' | \
tr -d ' ' | tr ',' '\n' | sort -t ':' | \
tr ':' '\t' | expand -t 30
echo -e "\nAll dependencies, including transitive dependencies"
sbt 'show managed-classpath' | tr -d ' ' | tr ',' '\n' | \
@jboner
jboner / latency.txt
Last active May 8, 2024 03:00
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r
@bobthecow
bobthecow / tab.bash
Last active November 10, 2023 08:47
Open new Terminal tabs from the command line
#!/bin/bash
#
# Open new Terminal tabs from the command line
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.tab.bash`) and source it in `.bashrc`
#
@stepancheg
stepancheg / gist:167566
Created August 14, 2009 01:15
How to convert Scala XML to JDK DOM
object XmlHelpers {
val docBuilder =
javax.xml.parsers.DocumentBuilderFactory.newInstance().newDocumentBuilder()
}
class NodeExtras(n: Node) {
def toJdkNode(doc: org.w3c.dom.Document): org.w3c.dom.Node =
n match {
case Elem(prefix, label, attributes, scope, children @ _*) =>
// XXX: ns