Skip to content

Instantly share code, notes, and snippets.

Philipp Klose TheHippo

Block or report user

Report or block TheHippo

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
@TheHippo
TheHippo / prepare-commit-msg
Last active Jul 13, 2016
If your git branch starts with a number add `ref #ISSUE-NUMBER` to commit msg
View prepare-commit-msg
#!/bin/bash
NAME=$(git branch | grep '*' | sed 's/* //')
ISSUE_NUMBER=$(git branch | grep '*' | sed 's/* //' | tr -dc '0-9')
if [ "$2" == "message" ]; then
echo "Message given, we do not modify the git commit message"
exit 0
fi
if [ "$2" == "merge" ] || [ "$2" == "squash" ]; then
echo "$2 commit, we do not edit the message"
exit 0
View main.go
package main
type Wrapper string
type Chain struct {
wrps []Wrapper
}
func (c Chain) Append1(wrps ...Wrapper) Chain {
newWrps := make([]Wrapper, len(c.wrps)+len(wrps))
@TheHippo
TheHippo / pre-commit
Last active Sep 6, 2019
`goimports` pre-commit hook
View pre-commit
#!/bin/sh
# Copyright 2012 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# git goimports pre-commit hook
#
# To use, store as .git/hooks/pre-commit inside your repository and make sure
# it has execute permissions.
#
@TheHippo
TheHippo / Makefile
Created Mar 31, 2016
Golang Makefile example
View Makefile
OUT := binariy-name
PKG := gitlab.com/group/project
VERSION := $(shell git describe --always --long --dirty)
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/)
all: run
server:
go build -i -v -o ${OUT} -ldflags="-X main.version=${VERSION}" ${PKG}
@TheHippo
TheHippo / main.go
Created Aug 15, 2015
Benchmarking Go Mutex overhead
View main.go
package main
import (
"fmt"
"sync"
)
type unlocked struct {
i int
}
@TheHippo
TheHippo / generateUUID.coffee
Last active Aug 29, 2015
Generate UUID like IDs in CoffeeScript
View generateUUID.coffee
generateUUID: () ->
d = new Date().getTime()
'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace /[xy]/g, (c) ->
r = (d + Math.random() * 16) % 16 | 0
d = Math.floor(d / 16)
(if c is 'x' then r else r & 0x3 | 0x8).toString 16
@TheHippo
TheHippo / commit-msg
Created Jan 27, 2015
Prepare and verify angular.js styled commit message with git flow
View commit-msg
#!/bin/bash
#
# abort commit if on feature/branch and nothing else than auto generated commit message
# is entered
current_branch=$(git rev-parse --abbrev-ref HEAD)
if [[ $current_branch == "feature/"* ]]
then
first_line=$(head -n 1 $1)
if [[ $first_line == "(${current_branch:8}):" ]]; then
echo 'No valid commit message entered.'
@TheHippo
TheHippo / 10-plug-up.rules
Last active Aug 29, 2015
Enable Plug-Up Security Key in Ubuntu
View 10-plug-up.rules
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev", ATTRS{idVendor}=="2581"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="f1d0", MODE="0660", GROUP="your_user_group"
@TheHippo
TheHippo / install-java.sh
Created Jul 22, 2014
Silent and automatic install of Oracles Java JDK under Ubuntu
View install-java.sh
#!/bin/bash
sudo add-apt-repository ppa:webupd8team/java --yes
sudo apt-get update
echo debconf shared/accepted-oracle-license-v1-1 select true | sudo debconf-set-selections
echo debconf shared/accepted-oracle-license-v1-1 seen true | sudo debconf-set-selections
DEBIAN_FRONTEND=noninteractive sudo apt-get install oracle-java7-installer --yes --force-yes --assume-yes
View keybase.md

Keybase proof

I hereby claim:

  • I am thehippo on github.
  • I am thehippo (https://keybase.io/thehippo) on keybase.
  • I have a public key whose fingerprint is B42E 4C13 BE39 A091 5154 C31B F2A5 FE09 95B6 4476

To claim this, I am signing this object:

You can’t perform that action at this time.