Skip to content

Instantly share code, notes, and snippets.

Lovro Mažgon lovromazgon

Block or report user

Report or block lovromazgon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lovromazgon
lovromazgon / fix-grub.sh
Last active Jul 22, 2019
This script fixes GRUB for systems, that were installed according to the Manual Full System Encryption guide (https://help.ubuntu.com/community/ManualFullSystemEncryption). It is inspired by the original script used in the guide and reuses a lot of parts from it. Use an Ubuntu Live CD / USB to get to a terminal and run the script from there.
View fix-grub.sh
#!/usr/bin/env bash
####################################################################################################
#
# FIX GRUB FOR ENCRYPTED INSTALLATION
#
# This script is based on the Troubleshooting part of the Manual Full System Encryption for Ubuntu.
# See https://help.ubuntu.com/community/ManualFullSystemEncryption/Troubleshooting
#
# This is NOT AN OFFICIAL Ubuntu script, it can and will break your system. Use at own risk.
@lovromazgon
lovromazgon / connect_box_restart.sh
Created Jun 25, 2019
This script restarts the ConnectBox from Magenta, an ISP in Austria.
View connect_box_restart.sh
#!/usr/bin/env bash
#
# This script restarts the ConnectBox from Magenta, an ISP in Austria.
#
# Run this script with LOGIN_USER and LOGIN_PASS env variables set to the
# username and password of the router and it will restart it.
#
# LOGIN_USER is 'NULL' by default, that is also the default router setting.
#
# Example usage:
@lovromazgon
lovromazgon / switch_audio_sink.sh
Last active May 6, 2019
Script for switching between 2 audio sinks
View switch_audio_sink.sh
#!/bin/bash
set -euo pipefail # strict mode
currentSink() { pacmd list-sinks | awk '{if($1=="*"){print $3;}}'; }
inactiveSink() { pacmd list-sinks | awk '{if($1=="index:"){print $2;}}'; }
sinkInputs() { pacmd list-sink-inputs | awk '{if($1=="index:")print $2}'; }
current_sink="$(eval currentSink)"
inactive_sink="$(eval inactiveSink)"
sink_inputs="$(eval sinkInputs)"
@lovromazgon
lovromazgon / github_projects_wip.user.js
Last active Feb 21, 2019
Tampermonkey script which changes the background of a column in Github projects if the work in progress limit is exceeded.
View github_projects_wip.user.js
// ==UserScript==
// @name Github Projects work in progress limit
// @namespace https://github.com/lovromazgon
// @version 0.4
// @updateURL https://gist.github.com/lovromazgon/1e02018cafa132d0655e8c6850f18e17/raw/github_projects_wip.user.js
// @downloadURL https://gist.github.com/lovromazgon/1e02018cafa132d0655e8c6850f18e17/raw/github_projects_wip.user.js
// @description Changes the background of a column in Github projects if the work in progress limit is exceeded.
// @author Lovro Mažgon
// @match https://github.com/toggl/*/projects/*
// @grant none
@lovromazgon
lovromazgon / Rabbit.java
Last active Feb 9, 2019 — forked from Chase-san/Rabbit.java
Rabbit Stream Cipher
View Rabbit.java
/**
* @see {@link http://tools.ietf.org/rfc/rfc4503.txt}
*/
public class Rabbit {
private static final int[] A = new int[] { 0x4D34D34D, 0xD34D34D3, 0x34D34D34, 0x4D34D34D, 0xD34D34D3, 0x34D34D34, 0x4D34D34D, 0xD34D34D3 };
private static final long MAX_UNSIGNED_INT = Integer.MAX_VALUE * 2l + 2; //2^32
private static final boolean DEBUG = false;
private int[] X;
private int[] C;
@lovromazgon
lovromazgon / toggle-go-version.sh
Created Jun 13, 2018
Simple script to toggle between Go versions.
View toggle-go-version.sh
#!/bin/bash
echo "Available go versions:"
result=$(ls -1 /usr/local/ | grep -i "go" | grep -v "^go$")
echo "$result" | nl
echo ""
printf "Which version shall it be: "
read -r num
View .vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => General
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Sets how many lines of history VIM has to remember
set history=500
" Enable filetype plugins
filetype plugin on
filetype indent on
@lovromazgon
lovromazgon / .bashrc
Created Jan 19, 2018
Support for multiple GOPATHs - set GOPATH on change of directory
View .bashrc
# with these functions you can have multiple gopath directories residing in /opt, where each gopath folder starts with "go-"
# when cd-ing to one of these directories (or any directory in them, on any level) the GOPATH gets changed automagically
function cd {
# call builtin cd. change to the new directory
builtin cd $@
# call a hook function that can use the new working directory
# to decide what to do
set_gopath
}
@lovromazgon
lovromazgon / tm_tempo_hours_diff.js
Last active Nov 9, 2017
Tampermonkey script which adds the information about required vs worked hours in Tempo.io
View tm_tempo_hours_diff.js
// ==UserScript==
// @name JIRA Hours Diff
// @namespace https://github.com/lovromazgon
// @version 0.2.3
// @updateURL https://gist.github.com/lovromazgon/7f2589530a36a8f355b05c087a82ee37/raw
// @description Adds the information about required vs worked hours in Tempo.io
// @author Lovro Mažgon
// @match https://app.tempo.io/timesheets/jira/reports/*
// @grant none
// ==/UserScript==
@lovromazgon
lovromazgon / multiinput_test.go
Created May 25, 2017
Test for stop of goflow component with multiple inputs
View multiinput_test.go
package test
import (
"github.com/trustmaster/goflow"
"fmt"
"testing"
"time"
)
// component 1
You can’t perform that action at this time.