Skip to content

Instantly share code, notes, and snippets.

@menski
menski / broken.html
Last active August 29, 2015 14:25
Jenkins Broken Jobs Overview
<!DOCTYPE html>
<html lang="en">
<head>
<title>Broken Jobs</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.0/css/materialize.min.css">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body>
@menski
menski / clean-registry-python2.py
Last active August 29, 2015 14:24
Remove unused images from docker registry v1 directory
#!/usr/bin/env python2
from __future__ import print_function
from glob import iglob
from json import load
from os import listdir
from sys import argv, exit
from shutil import rmtree
@menski
menski / jenkins-decrypt.py
Created April 7, 2015 20:51
Decrypt jenkins password hashes
#!/usr/bin/env python3
# original: https://raw.githubusercontent.com/tweksteen/jenkins-decrypt/master/decrypt.py
# requires: pycrypto
import re
import sys
import base64
@menski
menski / Makefile
Last active August 29, 2015 14:11
Makefile template for docker images
IMAGE_NAME=my/image
TAG=latest
IMAGE=$(IMAGE_NAME):$(TAG)
NAME=my-image
OPTS=--name $(NAME) $(FLAGS)
DOCKER=docker $(DOCKER_OPTS)
REMOVE=true
FORCE_RM=true
PROXY_IP=$(shell $(DOCKER) inspect --format '{{ .NetworkSettings.IPAddress }}' http-proxy 2> /dev/null)
@menski
menski / tag-get-started.sh
Created November 28, 2014 10:34
Script to update tags of camunda get started repos
#!/bin/sh
DELIM=${1:-:}
git log --format=oneline --reverse | while read line; do
hash=$(echo "$line" | cut -d\ -f 1)
name=$(echo "$line" | cut -d\ -f 2- | cut -d"$DELIM" -f 1 | tr " " "-")
msg=$(echo "$line" | cut -d\ -f 2- | cut -d"$DELIM" -f 2- | sed 's/^\s*//g')
git tag -f -a "$name" -m "$msg" $hash
@menski
menski / proxy.sh
Created November 27, 2014 18:44
Use http replicator as http proxy for docker build
#!/bin/sh
CACHE_DIR=cache
mkdir -p $CACHE_DIR
http-replicator -p 8080 -i *.*.*.* -d $CACHE_DIR -s --daemon --log $CACHE_DIR/replicator.log
# add e.g. `ENV http_proxy http://172.17.42.1:8080` to your Dockerfile
@menski
menski / MyTestScript.groovy
Created October 6, 2014 21:29
Deploy BPMN process with external script resource via REST API on heroku
println "Hello world"
execution.setVariable("groovy", "works")
@menski
menski / whereami.bash
Created August 23, 2014 20:54
Command line to print current ip geolocation
function whereami {
curl -sb -H "Connection: close" http://freegeoip.net/csv/ | tr -d \" | awk 'BEGIN{FS=","} {printf "%-6s: %s\n%-6s: %s %s, %s (%s %s)\n%-6s: %s, %s\n", "ip", $1, "city", $7, $6, $5, $3, $2, "coords", $8, $9}'
}
@menski
menski / i3status.py
Created August 10, 2014 21:00
i3 status extension script which adds fan and governor info
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# This script is a simple wrapper which prefixes each i3status line with custom
# information. It is a python reimplementation of:
# http://code.stapelberg.de/git/i3status/tree/contrib/wrapper.pl
#
# To use it, ensure your ~/.i3status.conf contains this line:
# output_format = "i3bar"
# in the 'general' section.
@menski
menski / SpinJson.java
Last active August 29, 2015 14:05
camunda Spin JSON support
// read JSON from String
SpinJsonNode json = JSON("{\"name\": \"camunda\", \"version\": \"7.2.0-alpha3\"}");
// read JSON object property as String
String version = json.prop("version").stringValue();
// calculate new version
int newVersion = Integer.valueOf(version.substring(version.length() - 1)) + 1;
version = version.substring(0, version.length() - 1 ) + newVersion;