Skip to content

Instantly share code, notes, and snippets.

View bobvanderlinden's full-sized avatar

Bob van der Linden bobvanderlinden

  • The Netherlands
View GitHub Profile
@bobvanderlinden
bobvanderlinden / build.gradle
Last active May 18, 2018 07:06
Git revision in Android build config using Gradle
def exec(String cmdline) {
def os = new ByteArrayOutputStream()
exec {
commandLine cmdline.split(" ")
standardOutput = os;
}
return os.toString().replaceAll('\\s', '')
}
def getGitSha() {
@bobvanderlinden
bobvanderlinden / default.nix
Created October 4, 2017 20:25
Example of reproducible deployments using nix-shell and nixops
{
server = {
deployment.targetHost = "target.host.com";
services.openssh.enable = true;
};
}
@bobvanderlinden
bobvanderlinden / configuration.nix
Created October 2, 2017 20:05
Gogs test configuration
{ config, pkgs, ... }:
{
virtualisation.graphics = false;
services.mingetty.autologinUser = "root";
boot.loader.grub.device = "/dev/sda";
networking.firewall.enable = false;
services.gogs = {
enable = true;
@bobvanderlinden
bobvanderlinden / FrameLayout.css
Created September 25, 2017 18:47
FrameLayout React component: scale content while maintaining aspect ratio
.framelayout {
margin: 0;
padding: 0;
border: 0;
display: flex;
align-items: center;
justify-content: center;
}
@bobvanderlinden
bobvanderlinden / keybase.md
Created September 20, 2017 10:08
keybase.md

Keybase proof

I hereby claim:

  • I am bobvanderlinden on github.
  • I am bobvanderlinden (https://keybase.io/bobvanderlinden) on keybase.
  • I have a public key ASD-ZmTE-wd3nzKSoc_5qjuJWSfzf4VNLu_QLdNYOy5O2Ao

To claim this, I am signing this object:

@bobvanderlinden
bobvanderlinden / example.html
Last active October 28, 2022 20:41
Simple QR-Code scanner based on jsqrcode
<html>
<head>
<script src="https://webqr.com/llqrcode.js"></script>
<script src="jsqrcode-camera.js"></script>
</head>
<body>
<div id="qrcodescanner"></div>
<div id="message"></div>
</body>
<script>
@bobvanderlinden
bobvanderlinden / test.nix
Created January 16, 2017 15:56
VM definition to test nginx virtualHost.<name>.serverName
{ nixpkgs ? ./default.nix,
nixos ? ./nixos/release.nix,
system ? "x86_64-linux"
}:
{
vm = (import ./nixos/lib/eval-config.nix {
inherit system;
modules = [
{
services.nginx = {
@bobvanderlinden
bobvanderlinden / gist:106687d41c8ca315972362fbdc4c12b1
Created January 11, 2017 22:27
Specific nixUnstable package
nix.package = (import (pkgs.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
rev = "6da8b0d49de784c72a3411b86656fa62656ea98e";
sha256 = "0rmmq67apl28kyl0dspgb4yrc5cq8q9mdcqk4gigmyirji96k4nx";
}) {}).pkgs.nixUnstable;
@bobvanderlinden
bobvanderlinden / builder.sh
Created June 3, 2016 18:12
Nix and npm-shrinkwrap
source $stdenv/setup
# Place npm-shrinkwrap.json alongside package.json
ln -s $NPM_SHRINKWRAP ./npm-shrinkwrap.json
# Create fake package.json. This is not used by npm when npm-shrinkwrap.json is available, but npm does parse this as json
echo "{}" > package.json
# Create fake HOME directory for npm
export HOME=$PWD/home
@bobvanderlinden
bobvanderlinden / acme.nix
Created May 31, 2016 12:39
Test whether nginx runs when configured to use ACME
# Test whether `nginx` can start when configured to use `acme`.
import ./make-test.nix ({ pkgs, ... } : {
name = "acme";
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ bobvanderlinden ];
};
nodes = {
server = { config, pkgs, ... }: {
services.nginx.enable = true;