Skip to content

Instantly share code, notes, and snippets.

@StefRe
StefRe / FileDemo.java
Created January 11, 2017 18:58
Java File and Path methods
import java.io.File;
import java.nio.file.Path;
import java.nio.file.Paths;
public class FileDemo {
public static void main(String[] args) throws Exception {
if( args.length != 1 ){
System.err.println( "Usage: FileDemo file" );
System.exit(1);
@StefRe
StefRe / DstAndLeapSecondsTest.java
Last active May 4, 2017 11:03
DST and Leap Secondes Test Java
import java.util.*;
public class DstAndLeapSecondsTest{
public static void main(String[] args){
Calendar start, old, curr;
long diff;
start = Calendar.getInstance();
@StefRe
StefRe / Year_vs_WeekYear.java
Created May 15, 2017 16:22
Year vs WeekYear
import java.util.*;
import java.text.SimpleDateFormat;
import java.util.Locale;
public class DstAndLeapSecondsTest{
public static void main(String[] args){
Calendar start, old, curr;
long diff;
@StefRe
StefRe / Google_Books_SLUB_Search.user.js
Last active May 31, 2017 16:06
GM script: Search the catalog of SLUB for the title
// ==UserScript==
// @name Google Books SLUB Search
// @namespace gist.github.com/StefRe
// @description Search the catalog of SLUB for the title
// @include https://books.google.de/books*
// @version 1.1
// @grant none
// ==/UserScript==
var link = document.createElement('a');
@StefRe
StefRe / GoogleBooksImages.user.js
Created June 2, 2017 10:17
GM script: Insert button to auto updating page with links to read pages for download
// ==UserScript==
// @name Google books images
// @namespace gist.github.com/StefRe
// @version 1.2
// @description Insert button to auto updating page with links to read pages for download
// @include https://books.google.*/books*
// @grant none
// ==/UserScript==
var imgsrcL, imgWindow, viewport, link;
@StefRe
StefRe / rud
Last active December 5, 2017 18:46
Russisch auf deutscher Tastatur phonetisch
// Russisch auf deutscher Tastatur phonetisch
partial alphanumeric_keys
xkb_symbols "rud" {
include "de(basic)"
name[Group1]= "Russian (Germany, alternative phonetic)";
key.type[group1]="FOUR_LEVEL_ALPHABETIC";
@StefRe
StefRe / gist:e933aab5b7c7f55e1b14b7134499e422
Created January 22, 2018 09:58
tumbview enable context menu on big image for slideshow thumbnails
// ==UserScript==
// @name tumbview enable context menu on big image
// @namespace Violentmonkey Scripts
// @match *://tumbview.com/*/plus/*
// @grant GM_addStyle
// ==/UserScript==
GM_addStyle ( `
#bigprev {
width: 20%; !important;
@StefRe
StefRe / stackprinter.user.js
Last active December 13, 2019 12:53
User script to add links to stackprinter.com for pretty printing SO questions and answers
// ==UserScript==
// @name Pretty print stackoverflow questions and answers
// @namespace gist.github.com/StefRe
// @description Add links to stackprinter for SO questions and answers
// @include https://stackoverflow.com/questions/*
// @include https://serverfault.com/questions/*
// @include https://superuser.com/questions/*
// @include https://stackapps.com/questions/*
// @include https://askubuntu.com/questions/*
// @include https://mathoverflow.net/questions/*
@StefRe
StefRe / CustomJodaFormat.java
Created January 16, 2020 12:25
Custom joda date format with Jackson serialization
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.joda.JodaModule;
import com.fasterxml.jackson.datatype.joda.cfg.JacksonJodaDateFormat;
import com.fasterxml.jackson.datatype.joda.ser.LocalDateSerializer;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.LocalDate;
@StefRe
StefRe / test_hook.py
Created April 19, 2020 07:58
Pytest report hooks
import pytest
# ----- general -----
@pytest.fixture(scope="function",
params=['none', 'setup', 'call', 'teardown', 'setup+call',
'setup+teardown', 'call+teardown', 'setup+call+teardown'])
def resource(request):
param = request.param
print('setup')
if 'setup' in param: