Skip to content

Instantly share code, notes, and snippets.

@jonboulle
jonboulle / benchmark.sh
Last active February 9, 2018 16:49 — forked from peterjmit/benchmark.sh
Bash Benchmark Script (using time)
#!/bin/bash
# Benchmark runner
repeats=20
output_file='benchmark_results.csv'
command_to_run='echo 1'
run_tests() {
# --------------------------------------------------------------------------
# Benchmark loop
@jonboulle
jonboulle / check_license.sh
Created April 13, 2016 14:20
license header checker thingy
#!/bin/sh
licRes=$(
for file in $(find . -type f -iname '*.go' ! -path './vendor/*'); do
head -n3 "${file}" | grep -Eq "(Copyright|generated|GENERATED)" || echo -e " ${file}"
done;)
if [ -n "${licRes}" ]; then
echo -e "license header checking failed:\n${licRes}"
exit 255
fi
@jonboulle
jonboulle / add_license.sh
Created April 13, 2016 14:19
license header creator thingy
#!/bin/bash
tmp=$(mktemp) # Create a temporary file
trap "rm -f $tmp; exit 1" 0 1 2 3 13 15
header='// Copyright 2016 The Foo Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
@jonboulle
jonboulle / main.go
Last active October 16, 2015 01:47
go-systemd journal test
package main
import (
"fmt"
"github.com/coreos/go-systemd/journal"
"github.com/coreos/go-systemd/sdjournal"
)
func main() {
#!/bin/bash -eu
tmpdir=$(mktemp -d)
repodir=$(pwd)
# first try to extract parts from the remote
# e.g. github.com/foo/bar/baz
# -> remote = github.com
remote=$(git ls-remote --get-url origin|awk -F ':' '{print $1}'|awk -F '@' ' {print $2}')
# -> path = foo/bar/baz