Skip to content

Instantly share code, notes, and snippets.

View rymdolle's full-sized avatar

Olle Mattsson rymdolle

View GitHub Profile
@rymdolle
rymdolle / _rebar3
Created November 4, 2016 21:23
rebar3 autocomplete for zsh
#compdef rebar3
#autoload
# rebar3 zsh completion
typeset -A opt_args
_rebar3() {
local rebar3_commands cmd cmds
if [[ "$CURRENT" -lt 2 ]]; then
# VCS
YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} "
YS_VCS_PROMPT_PREFIX2=":%{$fg[cyan]%}"
YS_VCS_PROMPT_SUFFIX="%{$reset_color%}"
YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x"
YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o"
# Git info
local git_info='$(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}"
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xvjf $1 ;;
*.tar.gz) tar xvzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xvf $1 ;;
*.tbz2) tar xvjf $1 ;;
@rymdolle
rymdolle / iptables-blacklist.conf
Created June 25, 2018 07:18
iptables ban action for blacklist file
# Fail2Ban configuration file
#
# Author: Cyril Jaquier
# Modified by Olle Mattsson to add blacklist file
#
[INCLUDES]
before = iptables-common.conf
@rymdolle
rymdolle / mping.escript
Created October 17, 2018 02:46
Simple mumble server ping util
#!/usr/bin/env escript
%%% Copyright 2018 Olle Mattsson <rymdolle@gmail.com>
%%%
%%% Ping a mumble server for basic statistics
%%%
main([]) ->
io:format("You must specify an address.\n\n"),
usage();
main([Host]) ->
@rymdolle
rymdolle / mumble_proto.lua
Created April 27, 2019 18:01
Wireshark plugin for dissecting mumble protocol
-- mumble protocol
mumble_proto = Proto("mumble", "Mumble Protocol")
local f_type = ProtoField.string("mumble.type", "type")
local f_length = ProtoField.uint32("mumble.length", "length", base.DEC)
local f_data = ProtoField.bytes("mumble.data", "data")
local HEADER_SIZE = 6
mumble_proto.fields = {
@rymdolle
rymdolle / uncurl
Created January 17, 2020 21:41
Use random user-agent of popular ones
#!/usr/bin/zsh -f
UA_ARRAY=(
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:63.0) Gecko/20100101 Firefox/63.0"
"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/17.17134"
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.102 Safari/537.36"
@rymdolle
rymdolle / __init__.py
Created August 2, 2020 21:17
handler for .well-known/matrix/server
from well_known.handler import matrix
__all__ = ["matrix"]
@rymdolle
rymdolle / midi.escript
Created November 26, 2020 19:03
dtxplorer MIDI remap
#!/usr/bin/env escript
-module(midi).
-export([parse_string/1]).
-export([save_file/2]).
-export([events/1]).
-export([varint/1]).
-export([varinte/1]).
@rymdolle
rymdolle / mullvad.sh
Created January 13, 2021 14:40
mullvad iptables
grep -H -Po '(?<=Endpoint = )(.+)(?=:)' mullvad-*.conf |\
sed -e 's/mullvad-/-A mullvad-wg -m comment --comment "/' -e 's/.conf:/" -d /' > mullvad-iptables.txt