Skip to content

Instantly share code, notes, and snippets.

:shipit:
Shipping​

Bouke van der Bijl bouk

:shipit:
Shipping​
Block or report user

Report or block bouk

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View quine.go
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 Nov 2, 2018
openconnect-palo-git edited
View PKGBUILD
# 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')
View just-hosts.rb
#!/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 Nov 4, 2016
path = Rails.root.join("tmp/cache/sprockets-lmdb-#{Rails.env}"); path.mkpath; env.cache = LMDBCacheStore.new(path.to_s)
View lmdb_cache_store.rb
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 Apr 25, 2016
Go server with automatic Let's Encrypt registration and graceful restarts
View server.go
package main
import (
"crypto/tls"
"github.com/facebookgo/grace/gracehttp"
"log"
"net/http"
"rsc.io/letsencrypt"
)
View 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
View index.html
<!DOCTYPE html>
<html>
<head>
<style>
* {
padding:0;
margin:0;
}
#canvas {
width:400px;
@bouk
bouk / index.html
Created Sep 8, 2015
Maps Overlay
View index.html
<!doctype html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html {
height:100%
}
body {
height:100%;
@bouk
bouk / bench_test.go
Last active Sep 1, 2015 — forked from SchumacherFM/bench_test.go
GoLang Benchmark: Map, StringSlice, Array, StructSlice
View bench_test.go
package main
// run with: $ go test --bench=. -test.benchmem .
// @see https://twitter.com/karlseguin/status/524452778093977600
import (
"math/rand"
"strconv"
"testing"
)
View cool.html
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
</head>
<body>
<canvas id="screen" width=640 height=640></canvas>
<script>
var step = 0;
function render(x, y, t) {
You can’t perform that action at this time.