Skip to content

Instantly share code, notes, and snippets.

View rymdolle's full-sized avatar

Olle Mattsson rymdolle

View GitHub Profile
@rymdolle
rymdolle / mp3_frames.cpp
Created April 18, 2024 13:34
create c header file with PCM samples from mp3 file
#include <cstdio>
#include <fstream>
#include <iostream>
#include <cassert>
#define MINIMP3_ONLY_MP3
/*#define MINIMP3_ONLY_SIMD*/
/*#define MINIMP3_NONSTANDARD_BUT_LOGICAL*/
#define MINIMP3_IMPLEMENTATION
@rymdolle
rymdolle / shiftgame.c
Last active July 22, 2021 19:11
Shift game
/*
* Copyright (c) 2021 Olle Mattsson <rymdolle@gmail.com>
*
* Compile:
* gcc -lcurses -o shiftgame shiftgame.c -Wall
*/
#include <stdio.h>
#include <stdlib.h>
#include <ncurses.h>
@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
@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 / __init__.py
Created August 2, 2020 21:17
handler for .well-known/matrix/server
from well_known.handler import matrix
__all__ = ["matrix"]
@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 / 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 / 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 / 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
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 ;;