Skip to content

Instantly share code, notes, and snippets.

@borkdude
borkdude / logger.clj
Last active April 27, 2021 20:23
Simple logger that works in bb
(ns logger)
(defmacro log [& msgs]
(let [m (meta &form)
_ns (ns-name *ns*) ;; can also be used for logging
file *file*]
`(binding [*out* *err*] ;; or bind to (io/writer log-file)
(println (str ~file ":"
~(:line m) ":"
~(:column m))
@arobb
arobb / sierra-virtualbox-install.md
Last active November 24, 2020 13:15
Install macOS Sierra in VirtualBox on macOS host

Step 1 (Creating a bootable macOS Sierra ISO for VirtualBox):

  1. hdiutil attach /Applications/Install\ macOS\ Sierra\ Public\ Beta.app/Contents/SharedSupport/InstallESD.dmg -noverify -nobrowse -mountpoint /Volumes/install_app
  2. hdiutil create -o /tmp/Sierra.cdr -size 7316m -layout SPUD -fs HFS+J
  3. hdiutil attach /tmp/Sierra.cdr.dmg -noverify -nobrowse -mountpoint /Volumes/install_build
  4. asr restore -source /Volumes/install_app/BaseSystem.dmg -target /Volumes/install_build -noprompt -noverify -erase
  5. rm /Volumes/OS\ X\ Base\ System/System/Installation/Packages
  6. cp -rp /Volumes/install_app/Packages /Volumes/OS\ X\ Base\ System/System/Installation/
  7. cp -rp /Volumes/install_app/BaseSystem.chunklist /Volumes/OS\ X\ Base\ System/BaseSystem.chunklist
@TikhonJelvis
TikhonJelvis / shell.nix
Last active October 18, 2020 03:24
A simple shell.nix for a Haskell project that calls cabal2nix for you.
{ nixpkgs ? import <nixpkgs> {}, compiler ? "default" }:
let
inherit (nixpkgs) pkgs;
# Build a default.nix file from our .cabal file:
here = ./.;
project = pkgs.stdenv.mkDerivation ({
name = "default.nix";
@jasonmp85
jasonmp85 / update-docker-docs
Last active December 14, 2022 11:43 — forked from ninrod/man-docker.sh
Install Docker man pages for your Docker version
#!/bin/bash
# make bash behave
set -euo pipefail
IFS=$'\n\t'
# adapted from: http://stackoverflow.com/a/32239112
# create tmpdir and register cleanup callback
tmpdir=$(mktemp -d ~/.docker-man.XXXXXXXX)
@mfuerstenau
mfuerstenau / zigzag-encoding.README
Last active October 17, 2024 04:35
ZigZag encoding/decoding explained
ZigZag-Encoding
---------------
Maps negative values to positive values while going back and
forth (0 = 0, -1 = 1, 1 = 2, -2 = 3, 2 = 4, -3 = 5, 3 = 6 ...)
(i >> bitlength-1) ^ (i << 1)
with "i" being the number to be encoded, "^" being
XOR-operation and ">>" would be arithemtic shifting-operation