Skip to content

Instantly share code, notes, and snippets.

View jeremija's full-sized avatar

Jerko Steiner jeremija

View GitHub Profile
@jeremija
jeremija / shot.sh
Created November 28, 2015 16:42
Create a screenshot to clipboard
#!/bin/bash
# takes a screenshot of a window or region and copy to clipboard as png
#
# prerequisites:
# - maim
# - slop
# - xclip with -target support (available in AUR)
#
# @author https://github.com/jeremija
@jeremija
jeremija / run-tests.sh
Last active November 10, 2015 14:55
Functional tests using curl and jq
#!/bin/bash
PREFIX='http://localhost:8080/oauth-example'
source 'tests-lib.sh'
# non-authenticated
test "curl $PREFIX/securedOAuth2Resources/my/clientRole" 401
test "curl $PREFIX/securedOAuth2Resources/my/clientHasAnyRole" 401
test "curl $PREFIX/securedOAuth2Resources/my/client" 401
test "curl $PREFIX/securedOAuth2Resources/my/user" 401
@jeremija
jeremija / autossh
Created August 15, 2015 08:58
raspi autossh
#! /bin/sh
# /etc/init.d/autossh
### BEGIN INIT INFO
# Provides: autossh
# Required-Start: $remote_fs $syslog $network
# Required-Stop: $remote_fs $syslog $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts autossh at boot.
@jeremija
jeremija / .Xmodmap
Last active August 29, 2015 14:19
My .vimrc file
! remove Caps Lock
clear lock
remove Lock = Caps_Lock
remove Shift = Caps_Lock
! add Mode_switch
keycode 66 = NoSymbol NoSymbol
keycode 66 = Mode_switch
keysym h = h H Left NoSymbol NoSymbol NoSymbol
keysym j = j J Down NoSymbol NoSymbol NoSymbol
@jeremija
jeremija / update-sublime.sh
Last active August 29, 2015 14:17
Sublime Text automatic update script
#!/bin/bash
# Checks for a new version of Sublime Text and automatically downloads and
# extracts it.
#
# author: https://github.com/jeremija
SUBLIME_INSTALL_DIR="$HOME/opt/"
DOWNLOAD_LOC="/tmp/sublime.tar.bz2"
CURRENT_VERSION=$(sublime --version | grep -o '[0-9]*')
URL=$(wget -O - -q https://www.sublimetext.com/3dev | grep -o 'http://[^"]*x64.tar.bz2')
@jeremija
jeremija / gist:54e44c382b15aff50f99
Created February 22, 2015 09:54
start fluidsynth midi server
fluidsynth --server --audio-driver=jack --connect-jack-outputs /usr/share/sounds/sf2/FluidR3_GM.sf2
@jeremija
jeremija / 90-tp-compact-keyboard.rules
Last active April 6, 2023 09:26
Attempt to persistent bluetooth pairing (Thinkpad Bluetooth Keyboard with Trackpoint)
# udev rules to be placed in /etc/udev/rules.d
# this is from https://github.com/lentinj/tp-compact-keyboard
SUBSYSTEM=="input", \
ATTRS{name}=="ThinkPad Compact Bluetooth Keyboard with TrackPoint", \
RUN+="/etc/udev/scripts/tp-compact-keyboard --fn-lock-enable"
# this is my script
SUBSYSTEM=="input", \
ATTRS{name}=="ThinkPad Compact Bluetooth Keyboard with TrackPoint", \
@jeremija
jeremija / HibernateTest.java
Created February 2, 2015 21:55
Hibernate Test case
package test.hibernate;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Restrictions;
import org.hibernate.service.ServiceRegistry;
import org.junit.Before;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import java.beans.PropertyDescriptor;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
public class Jsr310SupportedBeanPropertyRowMapper<T> extends BeanPropertyRowMapper<T> {
@jeremija
jeremija / muxtitles.py
Last active August 29, 2015 14:12
muxtitles
#!/usr/bin/env python3
#
# Uses subdl to download video subtitles and muxes it to a new mkv video. The only requirement is for the video is to
# be mkv-compatible.
#
# You can find the subdl here: https://github.com/akexakex/subdl/blob/master/subdl
#
# If you use xfce4/thunar, custom actions can be added for *.mp4 and *.mkv video files:
#
# xfce4-terminal --hold --execute /usr/local/bin/muxtitles %F