Skip to content

Instantly share code, notes, and snippets.

View srenatus's full-sized avatar
🍍

Stephan Renatus srenatus

🍍
View GitHub Profile
@srenatus
srenatus / Rego.sublime-syntax
Last active February 14, 2020 13:57
@eephillip has created a package for the sublime syntax, see https://github.com/eephillip/rego.sublime-package
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Rego
file_extensions:
- rego
- Rego
scope: source.rego
contexts:
main:
$ go tool compile -S main.go > main.asm
$ go tool compile -S main2.go > main2.asm
$ sed -i s/main2/main/ main2.asm
$ diff main.asm main2.asm # yields nothing
@srenatus
srenatus / gist:df9fe70f3bd72709ff13
Created December 23, 2015 09:08
command mockery, inspired by https://pbrisbin.com/posts/mocking_bash/ -- doesn't work properly yet but probably transports the idea. compared to the source, this tries to introduce some variability, i.e. the hash is built from "normalized" JSON input (keys are sorted). Oh and it cares for STDIN, because we'd need that.
package main
import (
"bufio"
"bytes"
"crypto/md5"
"encoding/json"
"fmt"
"io"
"io/ioutil"
@srenatus
srenatus / 20601.json
Created October 2, 2015 12:00
betterplace JSON
{
"id": 20601,
"created_at": "2014-07-21T16:19:26+02:00",
"updated_at": "2015-10-02T13:48:36+02:00",
"latitude": 52.36701189999999,
"longitude": 13.09298250000006,
"street": "",
"zip": "14478",
"city": "Potsdam",
"country": "Deutschland",
@srenatus
srenatus / Dockerfile
Last active September 9, 2015 10:33
htaccess test drive for crowd-funding (multilang); with docker installed: `docker build -t cf .; docker run -p 8080:80 cf`, then access http://127.0.0.1:8080
FROM ruby:2.1-onbuild
# execjs needs some js engine
RUN apt-get update && apt-get install -y --no-install-recommends nodejs apache2
# jekyll needs this
ENV LANG C.UTF-8
# "configure" apache
RUN sed -i 's#/var/www/html#/usr/src/app/build#' /etc/apache2/sites-enabled/000-default.conf
@srenatus
srenatus / console log
Created September 9, 2015 06:57
panic (boot2docker, win7, msys2)
$ winpty docker run -it debian:jessie bash
root@d3c36743f062:/# tput rc
oot@d3c36743f062:/# panic: runtime error: slice bounds out of range
goroutine 12 [running]:
bufio.(*Reader).fill(0xc08208a300)
/usr/local/go/src/bufio/bufio.go:86 +0x2e2
bufio.(*Reader).WriteTo(0xc08208a300, 0x3624f0, 0xc08200ab90, 0x3b, 0x0, 0x0)
/usr/local/go/src/bufio/bufio.go:449 +0x285
io.Copy(0x3624f0, 0xc08200ab90, 0x364738, 0xc08208a300, 0x0, 0x0, 0x0)
@srenatus
srenatus / docker volume tests
Created September 4, 2015 12:36
start a container from a container, with volumes.
docker@boot2docker:~$ pwd
/home/docker
docker@boot2docker:~$ docker run -it -v $(pwd)/foo:/foo -v /var/run/docker.sock:/var/run/docker.sock sse/jenkins bash
jenkins@ccfdbe3ccaac:/$ ls /foo/
bar foofoo
jenkins@ccfdbe3ccaac:/$ docker run -it -v /home/docker/foo/bar:/bar debian:jessie bash # <-- /!\
root@be6343378d9a:/# ls /bar
baz
root@be6343378d9a:/# date > /bar/bar
root@be6343378d9a:/# exit
@srenatus
srenatus / Dockerfile
Created June 22, 2015 08:35
spack/llvm problem
FROM debian:jessie
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y --no-install-recommends curl ca-certificates \
python git build-essential && \
apt-get clean
@srenatus
srenatus / WHY.md
Created October 14, 2014 14:20
minimal cabal config for stackage

With only line #1, you end up with cabal update returning

Downloading the latest package list from stackage
cabal: fromFlag NoFlag. Use fromFlagOrDefault
@srenatus
srenatus / chefdiff
Last active August 29, 2015 14:02
Chefdiff, executing a diff between the latest (chef) backup and the file in its usual location. Can be used with relative paths, e.g. `cd /etc; chefdiff my/files.conf`.
#!/opt/chef/embedded/bin/ruby
#
# Copyright (C) 2014 x-ion GmbH
#
# 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
#
# http://www.apache.org/licenses/LICENSE-2.0
#