Skip to content

Instantly share code, notes, and snippets.

View dch's full-sized avatar
🛋️

Dave Cottlehuber dch

🛋️
View GitHub Profile
@dch
dch / 20160106_macbookpro_retina_mbp_hardware.md
Created January 6, 2016 14:31
dch mbp 2014 retina 15" intel iris pro graphics

Hardware Overview:

Model Name:	MacBook Pro
Model Identifier:	MacBookPro11,2
Processor Name:	Intel Core i7
Processor Speed:	2,2 GHz
Number of Processors:	1
Total Number of Cores:	4
L2 Cache (per Core):	256 KB

L3 Cache: 6 MB

@dch
dch / rc.local.diff
Created November 20, 2015 14:12
A dirty patch to ensure that debian systems regenerate their ssh host keys on reboot if they are missing
--- rc.local.orig 2015-11-20 09:02:06.776959957 -0500
+++ rc.local 2015-11-20 09:02:32.096652026 -0500
@@ -11,4 +11,9 @@
#
# By default this script does nothing.
+if [ -f /etc/ssh/regenerate_host_keys ]; then
+ rm -f /etc/ssh/ssh_host_*_key*
+ dpkg-reconfigure openssh-server
+ rm /etc/ssh/regenerate_host_keys
@dch
dch / mix.exs
Created October 6, 2015 08:29 — forked from jeffweiss/mix.exs
Retrieving application version number in mix.exs from git describe
defmodule MyApp.Mixfile do
use Mix.Project
def project do
[app: :my_app,
version: get_version,
elixir: "~> 1.0",
elixirc_paths: elixirc_paths(Mix.env),
compilers: Mix.compilers,
build_embedded: Mix.env == :prod,
@dch
dch / spiped64.md
Last active September 24, 2015 14:41
6-4 pipe using spiped and localhost
# make a random key
# dd if=/dev/urandom of=/ramdisk/github.key bs=32 count=1
# stash on on jump box and lolcathost
# start a daemon on the ipv64 jump box using the 9418 git port as 443 is busy
/usr/local/bin/spiped -D -d -s \[::0\]:9418 -t 192.30.252.130:443 -k /ramdisk/github.key -p /var/run/spiped_GITHUB.pid
# laptop
/usr/local/bin/spiped -F -e -s \[::\]:443 -t jump.box:9418 -k /ramdisk/github.key &
@dch
dch / websockets-with-gun.ex
Created September 15, 2015 21:52 — forked from ashneyderman/gist:5eca8b1bed16a7b6f4be
Use of gun from elixir
defmodule Transport do
def connect(params) do
hostname = params.hostname
port = params.port
path = params.path
timeout = params.connection_timeout
{:ok, conn} = :gun.open(hostname, port)
{:ok, :http} = :gun.await_up(conn)
:gun.ws_upgrade(conn, path)
@dch
dch / xmerl_demo.ex
Last active September 15, 2015 06:54 — forked from sasa1977/xmerl_demo.ex
Simple xmerl usage demo in Elixir
defmodule XmlNode do
require Record
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl")
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl")
def from_string(xml_string, options \\ [quiet: true]) do
{doc, []} =
xml_string
|> :binary.bin_to_list
|> :xmerl_scan.string(options)
@dch
dch / unbound-osx-homebrew.md
Last active August 29, 2015 14:27 — forked from denji/unbound-osx-homebrew.md
Install unbound DNS(SEC) resolver on OS X, on the basis of https://www.spatof.org/blog/unbound-dns-resolver-on-osx.html
To install unbound you can use homebrew
$ brew install unbound ldns
Now we can edit the configuration file of unbound which by default is located in /usr/local/etc/unbound/unbound.conf:
@dch
dch / 20150806_ubuntu_vagrant_box.md
Created August 6, 2015 09:08
making a vagrant box by hand
#!/bin/bash
ERLANG=18.0
SQLITE=amalgamation-3071700
cd /root
SSLV=1.0.1o
[ -f /usr/bin/gcc ] || (apt-get update && apt-get install -y build-essential)
2015-07-24 20:47:11 +0200
./configure
--disable-debug
--prefix=/usr/local/Cellar/wxmac/3.0.2
--enable-unicode
--enable-std_string
--enable-display
--with-opengl
--with-osx_cocoa