Skip to content

Instantly share code, notes, and snippets.

View blaz-kranjc's full-sized avatar
👋
Bonjour!

Blaž Kranjc blaz-kranjc

👋
Bonjour!
  • Nets Switzerland
  • Geneva, Switzerland
  • 19:58 (UTC +02:00)
  • LinkedIn in/bkranjc
View GitHub Profile
@blaz-kranjc
blaz-kranjc / mvnjavadoc.sh
Created February 20, 2018 21:35
A simple script that extracts javadoc from maven and opens it in firefox for easy documentation browsing.
#!/bin/bash
set -e
IFS=':' read -r -a fullArtifactId <<< "$1"
usage () {
echo "Usage: $0 <groupId>:<artifactId>:<version>"
}
if [ ${#fullArtifactId[@]} -ne 3 ] ; then
@blaz-kranjc
blaz-kranjc / Heartbeat.db
Created October 26, 2017 13:50
EPICS Heartbeat
##
# Provides heartbeat monitor
##
record(longout, "$(DEVICE):HB_TIMER") {
field(DESC, "Timer for heartbeat.")
field(SCAN, "1 second")
field(SDIS, "$(SWITCH)")
field(DISV, 0)
field(OUT, "$(DEVICE):HEART PP")
@blaz-kranjc
blaz-kranjc / EnumBitset.java
Created October 26, 2017 13:19
Trying to make DRY Enum bitsets
package low.level.stuff;
import java.lang.reflect.InvocationTargetException;
import java.util.EnumSet;
import java.util.Set;
interface EnumBitsetGeneric<T extends Enum<T> & EnumBitsetGeneric<T>> { // Actually as none of this works EnumBitset does not need to be generic
int getBitPosition();
//byte valueOf(Set<T> flags); // Cannot do this, as I want this method to be static
//Set<T> flagsOf(byte value); // Cannot do this, as I want this method to be static
@blaz-kranjc
blaz-kranjc / elevator-make
Last active March 29, 2017 10:32
make wrapper that plays music during compilation
#!/bin/bash
mplayer -loop 0 -slave /var/local/elevator.ogg &>/dev/null &
ELEVATOR_PID=$!
/usr/bin/make "$@"
function finally() {
kill $ELEVATOR_PID &>/dev/null
}
#!/usr/bin/env python2
# Implementation of visual encryption generator from
# http://www.datagenetics.com/blog/november32013/index.html
#
# The input files are three png images and should be placed in the same directory.
# The names are hardcoded:
# in1.png, in2.png : input images that are used on the encoded images
# hidden.png : input image that is shown when encoded images are overlayed
import numpy as np