Skip to content

Instantly share code, notes, and snippets.

@homburg
homburg / gsww
Created May 10, 2023 09:28
gsww - pick and checkout git branch, sorted after last checked out
#!/usr/bin/env node
const { execSync, spawnSync } = require('child_process');
const readline = require('readline');
const stream = require('stream');
const lines = execSync("git reflog --no-color");
var bufferStream = new stream.PassThrough();
bufferStream.end(lines);
const suffix_length = ".l.jfjf.dk".length;
async function onRequest(context, url, request) {
const [fake_host, raw_port] = request.host.slice(0, -suffix_length).split("__");
let port = Number(raw_port);
if (!port || isNaN(port)) {
port = 443;
}
@homburg
homburg / git-abstract.md
Created December 8, 2017 13:35
Git workshop abstract

Abstract - GIT

Git er bygget om et lille antal (indforståede) koncepter. Ved at få en introduktion til git's byggesten, kan man få en bedre forståelse af hvordan git fungerer og hvilke tilstande et git-repository kan komme i.

Emner

  • .git-mappen
  • git objekter (commit, tree, blob, annotated tag)
  • refs (tags, branches, HEAD)
@homburg
homburg / dk
Last active March 25, 2018 16:07
Ubuntu custom keyboard layout
# Custom layout
# Add to /usr/share/X11/xkb/symbols/dk
partial alphanumeric_keys
xkb_symbols "custom" {
include "dk(basic)"
name[Group1]="Danish (custom)";
key <TLDE> { [ dollar, asciitilde, threequartes, paragraph ] };
@homburg
homburg / Counter.elm
Created March 21, 2016 13:43
Elm compiler misleading error
module Counter where
import Html exposing (..)
import Html.Attributes exposing (style)
import Html.Events exposing (onClick)
-- MODEL
type alias Model = Int
@homburg
homburg / keybase.md
Created March 7, 2015 09:28
keybase.md

Keybase proof

I hereby claim:

  • I am homburg on github.
  • I am homburg (https://keybase.io/homburg) on keybase.
  • I have a public key whose fingerprint is 99EF C7E0 5AFB 2375 33E9 7F45 5235 277B C827 0040

To claim this, I am signing this object:

@homburg
homburg / maybe-pager.go
Created November 3, 2014 21:55
Pager pipe (like git)
package main
// From
// http://stackoverflow.com/questions/21738674/how-do-i-print-a-buffer-to-stdout-piped-through-a-pager
// http://rosettacode.org/wiki/Terminal_control/Dimensions
import (
"bufio"
"io"
"os"
"os/exec"
@homburg
homburg / git-get
Last active August 29, 2015 14:05
git clone to home dir + repo path
#!/usr/bin/env python
import os, sys, errno
if len(sys.argv) <= 1:
os.execlp("git", "git")
repo = str(sys.argv[-1])
if repo.endswith(".git"):
repo = repo[:-4]
@homburg
homburg / playbook-book.yml
Last active August 29, 2015 14:01
Ansible command line booleans
---
- hosts: all
vars:
docker: 0
tasks:
- name: ensure bool variables work
debug: msg="docker {{ docker }}.."
# When: takes a jinja2 expression
# 0 evaluates to false
# >= 1 evaluates to true
@homburg
homburg / my-go-service.conf
Last active January 4, 2019 21:09
Golang upstart init script (from githbucket.org/kardianos/service)
# /etc/init/my-go-service.conf
# My go service
description "My go service"
env DAEMON=/usr/local/bin/my-go-service
env NAME=my-go-service
start on filesystem or runlevel [2345]
stop on runlevel [!2345]