Skip to content

Instantly share code, notes, and snippets.

@lovromazgon
lovromazgon / Rabbit.java
Last active February 9, 2019 15:52 — forked from Chase-san/Rabbit.java
Rabbit Stream Cipher
/**
* @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 June 13, 2018 07:35
Simple script to toggle between Go versions.
#!/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
@lovromazgon
lovromazgon / .vimrc
Last active March 4, 2018 20:15
My 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 / tm_tempo_hours_diff.js
Last active November 9, 2017 09:06
Tampermonkey script which adds the information about required vs worked hours in Tempo.io
// ==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 10:23
Test for stop of goflow component with multiple inputs
package test
import (
"github.com/trustmaster/goflow"
"fmt"
"testing"
"time"
)
// component 1
@lovromazgon
lovromazgon / CLIProgressBar.java
Last active March 21, 2016 20:54
A CLI progress bar in Java and InputStream wrapper around the progress bar for ease of use.
package dap.util;
import java.io.PrintStream;
/**
* The CLIProgressBar outputs a progress bar and the time remaining for completing a task.
* <p>
* To use it you must provide the total size / total number of iterations for your task (e.g. file length)
* and update the current position after each iteration.
* <p>
@lovromazgon
lovromazgon / download_learnyousomeerlang.sh
Created February 25, 2016 20:39
Bash script for downloading all content of learnyousomeerlang.com and creating a single html
#!/bin/bash
FIRST_URL="http://learnyousomeerlang.com/introduction"
FOLDER="html"
OUTPUT_FILENAME="learnyousomeerlang.html"
mkdir $FOLDER
url=$FIRST_URL
i=1
while true; do
@lovromazgon
lovromazgon / subtitle-downloader.sh
Last active October 8, 2015 16:47
Downloads the subtitles for all episodes of one season of a TV series - usage: ./subtitle-downloader.sh -s [season] {-l [ISO 639-1 language code] -e [comma separated episodes]} [TV series title]
#!/bin/bash
# Downloads the most popular subtitles for all episodes of one season of a TV series
#
# Flags:
# -s : define the season (required if 'u' is missing)
# -u : explicitly define the URL (required if 's' is missing)
# -l : define the language code ISO 639-1 (optional, default: sl)
# -e : define the episodes in a comma separated list (optional, default: all)
# -h : displays this message