Skip to content

Instantly share code, notes, and snippets.

Running phase: unpackPhase
unpacking source archive /nix/store/d4bmxqwn7mf8v6ax4xmnmmk8qff9dm39-source
source root is source
Running phase: patchPhase
Running phase: updateAutotoolsGnuConfigScriptsPhase
Running phase: configurePhase
fixing cmake files...
cmake flags: -DCMAKE_FIND_USE_SYSTEM_PACKAGE_REGISTRY=OFF -DCMAKE_FIND_USE_PACKAGE_REGISTRY=OFF -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LOCALEDIR=/nix/store/xwzrla1j021gpbnb6d5n6r01gdhn2314-openmvs-2.3.0/share/locale -DCMAKE_INSTALL_LIBEXECDIR=/nix/store/xwzrla1j021gpbnb6d5n6r01gdhn2314-openmvs-2.3.0/libexec -DCMAKE_INSTALL_LIBDIR=/nix/store/xwzrla1j021gpbnb6d5n6r01gdhn2314-openmvs-2.3.0/lib -DCMAKE_INSTALL_DOCDIR=/nix/store/xwzrla1j021gpbnb6d5n6r01gdhn2314-openmvs-2.3.0/share/doc/OpenMVS -DCMAKE_INSTALL_INFODIR=/nix/store/xwzrla1j021gpbnb6d5n6r01gdhn2314-openmvs-2.3.0/share/info -DCMAKE_INSTALL_MANDIR=/nix/store/xwzrla1j021gpbnb6d5n6r01gdhn2314-openmvs-2.3.0/share/man -DCMAKE_INSTALL_OLDINCLUDEDIR=/nix/store/xwzrla1j0
@bouk
bouk / parse-yarn-lock.nix
Last active September 3, 2023 19:00
Parse a v1 yarn.lock into a nix expression. Try it with `nix eval -f parse-yarn-lock.nix`
# Parse a yarn.lock file using pure Nix
# yarn.lock v1 files are basically YAML with support for having multiple keys for a single value in a map and without array support.
# Inspired by https://github.com/yarnpkg/yarn/blob/158d96dce95313d9a00218302631cd263877d164/src/lockfile/parse.js
with builtins;
let
# Add index to a list of elements
enumerate = list: genList (i: ({ inherit i; e = elemAt list i; })) (length list);
mkToken = type: value: { inherit type value; };
parseLockfile = str: let
Rails.application.eager_load!
ApplicationRecord.subclasses.sort_by(&:name).each do |klass|
puts "#{klass.table_name}"
puts "==="
puts
puts "| Column | Type |"
puts "|--------|------|"
klass.columns.each do |column|
@bouk
bouk / up.sh
Created July 7, 2021 12:57
dev/up
#!/usr/bin/env bash
# Exit on fail
set -euo pipefail
check_or_install() {
brew list --versions "$1" &>/dev/null || brew install "$1"
}
export PGDATA="$PWD/dev/postgres"
@bouk
bouk / quine.go
Last active June 26, 2019 20:59
Quines
package main
import "fmt"
func main() {
p := "package main\n\nimport \"fmt\"\n\nfunc main() {\n\tp := %q\n\tfmt.Printf(p, p)\n}"
fmt.Printf(p, p)
}
@bouk
bouk / PKGBUILD
Last active November 2, 2018 18:11
openconnect-palo-git edited
# Maintainer: Serge Bakharev <serge.bakharev@gmail.com>
# Contributor: Bouke van der Bijl <me@bou.ke>
pkgname=openconnect-palo-git
_pkgname=openconnect
pkgver=7.08.r157.ge5fe063a
pkgrel=1
pkgdesc="VPN client for Palo Alto GlobalProtect VPN"
arch=('i686' 'x86_64')
license=('GPL')
#!/usr/bin/env ruby
# Copyright Bouke van der Bijl
require 'nokogiri'
# This script interpretes the HTTPS everywhere rulesets and extracts a list of hosts which are eligible for a 'simple' redirect,
# e.g. where http://example.com needs to be redirected to https://example.com
def is_simple?(rule)
rule.attributes['from'].value == "^http:" && rule.attributes['to'].value == "https:"
end
@bouk
bouk / lmdb_cache_store.rb
Last active November 4, 2016 01:07
path = Rails.root.join("tmp/cache/sprockets-lmdb-#{Rails.env}"); path.mkpath; env.cache = LMDBCacheStore.new(path.to_s)
require 'lmdb'
require 'snappy'
class LMDBCacheStore
attr_reader :max_size, :env, :db, :lru
delegate :size, to: :db
# The LMDB Gem has a bug where the Environment garbage collection handler will crash sometimes
# if the environment wasn't closed explicitely before the reference was lost.
# As a shitty workaround, we can make sure that we never lose a reference to the Environment by
@bouk
bouk / server.go
Created April 25, 2016 14:45
Go server with automatic Let's Encrypt registration and graceful restarts
package main
import (
"crypto/tls"
"github.com/facebookgo/grace/gracehttp"
"log"
"net/http"
"rsc.io/letsencrypt"
)
@bouk
bouk / immutable.js
Last active March 15, 2016 00:00 — forked from cpojer/immutable.js
// Copyright 2004-present Facebook. All Rights Reserved.
/**
* Immutable data encourages pure functions (data-in, data-out) and lends itself
* to much simpler application development and enabling techniques from
* functional programming such as lazy evaluation.
*
* While designed to bring these powerful functional concepts to JavaScript, it
* presents an Object-Oriented API familiar to JavaScript engineers and closely
* mirroring that of Array, Map, and Set. It is easy and efficient to convert to