Skip to content

Instantly share code, notes, and snippets.

@Romern
Romern / bar.sh
Last active April 11, 2017 10:01 — forked from csssuf/bar.sh
Adds now playing indicator from spotify to i3status. Better to use playerctl and i3blocks, but it works
#!/bin/bash
i3status | while :
do
read line
dir=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
spotify_status=$(dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'PlaybackStatus' | tail -n1 | cut -d'"' -f2 | sed -e 's/[\/&]/\\&/g')
spotify_artist=$(dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | awk -f ${dir}/spotify_song.awk | head -n 1 | cut -d':' -f2 | sed -e 's/[\/&]/\\&/g')
spotify_song=$(dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | awk -f ${dir}/spotify_song.awk | tail -n 1 | cut -d':' -f2 | sed -e 's/[\/&]/\\&/g')
0xf9133cb0ccc6e75aab5a427ccbc2edc7b308a010
@Romern
Romern / LICENSE
Last active August 7, 2018 18:08
Latex Aufgaben Template slightly modified https://git.rwth-aachen.de/kevin.meder/LaTeX_Templates
MIT License
Copyright (c) 2017 Nino van der Linden, Kevin Meder
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@Romern
Romern / telegramlayoutunrestricter.user.js
Last active November 4, 2018 12:25
Telegram has a very stupid restricted layout. This userscript removes all width restrictions. Also works with rambox.
// ==UserScript==
// @name Telegram - Full Sized Windows
// @namespace http://userstyles.org
// @description Telegram has a very stupid restricted layout. This removes all width restrictions
// @author Roman Karwacik
// @run-at document-idle
// @match https://web.telegram.org/*
// @version 1
// ==/UserScript==
(function() {
@Romern
Romern / slackhidesidebar.user.js
Created March 30, 2018 10:03
If you use only one channel in slack or your window is narrow, you may want to hide Slacks sidebar.
// ==UserScript==
// @name Slack: Hide sidebar
// @namespace http://userstyles.org
// @description Slack doesn't support narrow windows that good. This hides the sidebar.
// @author Roman Karwacik
// @run-at document-start
// @match https://*.slack.com/*
// @version 1
// ==/UserScript==
(function() {var css = [
@Romern
Romern / snake.c
Last active April 8, 2018 13:57
Snake written for Arduino with tiny screen
//SNAKE
#include "lcd.h"
#include "util.h"
#include "os_input.h"
#include "os_core.h"
#include "os_scheduler.h"
#include "os_memory.h"
#include "keyb_processor.h"
@Romern
Romern / OkusonParser.java
Last active July 16, 2018 08:34
OkusonParser LAInf18 Needs https://jsoup.org/packages/jsoup-1.11.2.jar in the same path
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import java.io.File;
import java.nio.charset.StandardCharsets;
import java.io.IOException;
import java.nio.file.Files;
import java.util.*;
@Romern
Romern / les.sh
Last active May 6, 2018 12:39
LaTeX Error Search: Finds typod commands in your tex file using the \show command
FILE=$1
if [ -z $1 ]; then
echo "ERROR: First input parameter must be the file!"
exit
fi
COMMANDS="$(grep -E -o '\\[a-zA-Z]+' $1 | sed 's/\\/\\show\\/g')"
HEADER="$(sed '/\\begin{document}/q' $1)"
echo $HEADER >> temp.tex
echo $COMMANDS >> temp.tex
echo '\end{document}' >> temp.tex
@Romern
Romern / RPNICompleteProof.java
Created May 12, 2018 22:37
Checks for a given DFA if a sampleset S=(S_+,S_-) is RPNI-complete (uses https://github.com/LearnLib/automatalib)
import net.automatalib.automata.fsa.impl.compact.CompactDFA;
import net.automatalib.util.automata.Automata;
import net.automatalib.util.automata.builders.AutomatonBuilders;
import net.automatalib.visualization.Visualization;
import net.automatalib.words.Alphabet;
import net.automatalib.words.Word;
import net.automatalib.words.impl.Alphabets;
import java.util.*;
public final class RPNICompleteProof {
@Romern
Romern / ogham_backconvert.js
Last active October 22, 2018 20:36
Small js script using https://github.com/evanshortiss/ogham to convert ogham phrases back to latin (with no changes to the database because I'm lazy)
//const ogham = require('ogham');
let test = {
individual: {
' ': {
char: ' ',
code: 5760
},
b: {
char: 'ᚁ',
code: 5761