Skip to content

Instantly share code, notes, and snippets.

@thbkrkr
thbkrkr / gist:8698813
Created January 29, 2014 22:45
Recover dropped stashed in git
for ref in `git fsck --unreachable | grep commit | cut -d' ' -f3`; do git show --summary $ref; done | less
source: http://stackoverflow.com/questions/89332/recover-dropped-stash-in-git
@thbkrkr
thbkrkr / HumanUser.scala
Created April 18, 2014 23:36
The com.actoboard.auth.HumanUser class comment by @bluxte
package com.actoboard.auth
import org.mindrot.jbcrypt.BCrypt
import com.actoboard.base.mongo._
import com.fasterxml.jackson.annotation.{JsonTypeName, JsonView}
import com.actoboard.base.util.StringUtils
/**
* A human principal.
@thbkrkr
thbkrkr / arduimocpost.go
Created July 7, 2014 00:00
Play with Go! Toggle between play and pause by pressing a push button. #arduino #mocp #post-json
package main
import (
"bytes"
"encoding/json"
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/api"
"github.com/hybridgroup/gobot/platforms/firmata"
"github.com/hybridgroup/gobot/platforms/gpio"
@thbkrkr
thbkrkr / logstash.conf
Created October 9, 2014 19:25
Logstash configuration to parse Scala/Java logs with a codec multine to join exception and stacktrace messages into a single event and a grok filter to extract the fields (timestamp, level, thread, class and message). The log file is parsed from the beginning, rm ~/.sincedb_ * to reindex it.
# 2014-10-09 10:47:47,358 INFO (pool-4-thread-2) [io.krkr.Pof] Bla bla ...
input {
file {
type => "xyz"
path => "/var/log/xyz/server-xyz.log"
start_position => "beginning"
codec => multiline {
pattern => "^%{TIMESTAMP_ISO8601} "
@thbkrkr
thbkrkr / gist:77d35477095ec91724cc
Created December 17, 2014 16:01
Google Hangouts easter eggs
/bikeshed # changes the color background for everyone
/shydino # a little shy dino shows up
/pitchforks # angry mob running across the chat
/ponies # a pony running across the chat
/ponystream # ponies running across the chat (only local)
konami cheat # changes your local background
yay!!
happy birthday
@thbkrkr
thbkrkr / test-dashb.json
Created February 5, 2015 14:07
test-dashb.json
{
"title": "All logs",
"services": {
"query": {
"list": {
"0": {
"query": "type:\"java-app\"",
"alias": "",
"color": "#7EB26D",
"id": 0,
#!/bin/bash -eu
HEIGHT=1600
WIDTH=900
FPS=24
OUT=something.mp4
VLC=cvlc
echo "Screen recording started..."
$VLC --quiet screen:// -I dummy \
@thbkrkr
thbkrkr / install_wheezy-backports_linux-image-amd64_kernel_3.16.sh
Last active August 29, 2015 14:16
Install Debian wheezy-backports linux-image-amd64 kernel 3.16 for Docker
su root
echo 'deb http://http.debian.net/debian wheezy-backports main' > /etc/apt/sources.list.d/wheezy-backports.list
apt-get update && apt-get install -t wheezy-backports linux-image-amd64
# Check grub menu entries. Linux 3.16.X-amd64 should be the second entry (index = 1)
grep menuen /boot/grub/grub.cfg
sed -i "s/GRUB_DEFAULT=.*/GRUB_DEFAULT=1/" /etc/default/grub
@thbkrkr
thbkrkr / Makefile
Created April 1, 2015 14:16
Build, tag and push Docker image
ORG = krkr
NAME = blurb
SHA1 = $(shell git log -1 --pretty=oneline | cut -c-10)
BRANCH = $(shell git branch -a --contains $(SHA1) | egrep '(remotes/|\*)' | egrep -v "(HEAD|detached)" | head -1 | sed -e "s/\* //" -e "s/.*\///")
VERSION = $(BRANCH)-$(SHA1)
REGISTRY = registry.blurb.com
build:
docker build --rm -t $(ORG)/$(NAME):${VERSION} .
docker tag -f $(ORG)/$(NAME):${VERSION} $(ORG)/$(NAME):$(BRANCH)-latest
@thbkrkr
thbkrkr / upgrade-git.sh
Last active August 29, 2015 14:22
Get latest git version
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install git
git --version