Skip to content

Instantly share code, notes, and snippets.

View kwk's full-sized avatar

Konrad Kleine kwk

View GitHub Profile
@kwk
kwk / .gitconfig
Last active June 4, 2023 14:31
Aliases to quickly find git commits made in quarter of a year
[alias]
# List your commits by quarters of a year in reverse order (short version)
q1 = "!f() { year=$1; shift; git log --author \"$(git config --get user.name)\" --since \"January $year\" --until \"March $year\" --oneline --reverse $@; }; f"
q2 = "!f() { year=$1; shift; git log --author \"$(git config --get user.name)\" --since \"April $year\" --until \"June $year\" --oneline --reverse $@; }; f"
q3 = "!f() { year=$1; shift; git log --author \"$(git config --get user.name)\" --since \"July $year\" --until \"September $year\" --oneline --reverse $@; }; f"
q4 = "!f() { year=$1; shift; git log --author \"$(git config --get user.name)\" --since \"October $year\" --until \"December $year\" --oneline --reverse $@; }; f"
# List your commits by quarters of a year in reverse order (long version)
quarter1 = "!f() { year=$1; shift; git log --author \"$(git config --get user.name)\" --since \"January $year\" --until \"March $year\" --reverse $@; }; f"
quarter2 = "!f() { year=$1; shift; git
#!/bin/bash
JQPATH=$(which jq)
if [ "x$JQPATH" == "x" ]; then
echo "Couldn't find jq executable." 1>&2
exit 2
fi
set -eu
shopt -s nullglob
@kwk
kwk / README.md
Created October 1, 2014 13:52
Forgot to sign-off commits?

No problem,

run

git filter-branch --msg-filter "cat - && echo && echo 'Signed-off-by: Your Name <Your.Name@example.com>'" HEAD~2..HEAD

To sign-off the last two commits.

Then force to push them to the remote repo with the -f option:

# this forces dpkg not to call sync() after package extraction and speeds up install
RUN echo "force-unsafe-io" > /etc/dpkg/dpkg.cfg.d/02apt-speedup
# we don't need and apt cache in a container
RUN echo "Acquire::http {No-Cache=True;};" > /etc/apt/apt.conf.d/no-cache
@kwk
kwk / CMakeLists.txt
Created February 9, 2015 13:37
Use boost from Git repo together with CMake External Project
project(regex)
cmake_minimum_required(VERSION 2.8)
# For some external project macros
include(ExternalProject)
# Download boost from git and build regex module
ExternalProject_Add(
@kwk
kwk / linktype-response.json
Last active October 14, 2016 07:54
This is a collection of potential responses for our services in the the JSON API format
{
"jsonapi": {
"version": "1.0"
},
"meta": {
"comment": [
"This is an example response for querying the link type bug-blocker-link",
"in the JSON API format.",
"",
"This document is a fully valid JSON API document. It's length is caused",
{
"meta" : {
"totalCount" : 1
},
"links" : {
"last" : "http://localhost:8080/api/workitems?page[offset]=0&page[limit]=20&filter[iteration]=64e8b7a1-f6b0-4712-9f13-2ce09f2f54ba",
"first" : "http://localhost:8080/api/workitems?page[offset]=0&page[limit]=20&filter[iteration]=64e8b7a1-f6b0-4712-9f13-2ce09f2f54ba"
},
"data" : [
{
{
"data" : [
{
"relationships" : {
"workitems" : {
"links" : {
"related" : "http://localhost:8080/api/workitems?filter[iteration]=64e8b7a1-f6b0-4712-9f13-2ce09f2f54ba"
}
},
"space" : {
@kwk
kwk / build-and-run.sh
Created February 2, 2017 14:32
Build and run a custom almighty-core docker image and run it
# Checkout the sourcecode
cd /tmp
git clone https://github.com/almighty/almighty-core.git
cd almighty-core
# Start a container that has all the build tools installed
make docker-start
# Run all the steps in order to create the artifacts
make docker-build
@kwk
kwk / create_random_links.sql
Created February 27, 2017 16:57
Creates links from a given type between distinct work items.