Skip to content

Instantly share code, notes, and snippets.

@max-te
max-te / switchprofile.sh
Created January 10, 2024 16:03
Switch bluetooth audio profile based on wether something uses the mic
#!/bin/bash
if ! (pactl list short sources | grep virt); then
pactl load-module module-remap-source source_properties="device.description=virt" source_name=virt channel_map=mono channels=1
fi
trap "pactl unload-module module-remap-source" SIGINT
pactl set-default-source virt
@max-te
max-te / rot.awk
Created October 8, 2017 13:13
Automatic xinput transformation matrix
function matrix(name, a,b,c, d,e,f, g,h,i){
name[1,1] = a
name[1,2] = b
name[1,3] = c
name[2,1] = d
name[2,2] = e
name[2,3] = f
name[3,1] = g
name[3,2] = h
name[3,3] = i
@max-te
max-te / invtree.py
Created February 18, 2016 23:27
Alphabetic Inventory Sorting
# This script needs a csv NEI Item Panel Dump.
# To get one make sure your search field is empty and go to
# the NEI Options > Tools > Item Panel. Make sure the left button is on CSV and click dump.
# Drop this script in the same directory as the generated itempanel.csv and run it.
# (Tested with Python 3.4)
# Move the InvTweaksTree.txt to your config directory.
import csv
def normalize(name):
@max-te
max-te / AD-alles.txt
Created March 4, 2015 14:58
AD-Vorbereitung
MASTER THEOREM
If T(n) = a*T(ceil(n/b)) + O(n^d) for some a > 0, b > 1, d ≥ 0,
Then T(n) = { O(n^d) if d > log_b(a),
{ O(n^d log n) if d = log_b(a),
{ O(n^log_b(a)) if d < log_b(a).
ARRAY
DOUBLY LINKED LIST
insert O(1), delete O(1), get O(n), deleteFromTo O(1), insertList O(1)
SINGLY LINKED LIST
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@max-te
max-te / familie.pl
Created October 24, 2012 15:45
SE3 - Übung 1
% mutter_von( Mutter , Kind ).
% 'Mutter' und 'Kind' sind Argumentpositionen,
% so da"s 'Mutter' die Mutter von 'Kind' ist.
:- dynamic mutter_von/2, vater_von/2. % ermoeglicht dynamische Veraenderung
%:- multifile mutter_von/2, vater_von/2. % ermoeglicht verteilte Definition in mehreren Files
mutter_von( marie , hans ).
mutter_von( marie , helga ).
mutter_von( julia , otto ).
@max-te
max-te / youtube.js
Created September 17, 2012 15:56
Download Youtube-Video in node.js
var http = require('http')
var fs = require('fs')
var argv = require('optimist').argv
var rxVideoID = /v=([\]\[!"#$%'()*+,.\/:;<=>?@\^_`{|}~-\w]*)/
var link = argv._.toString()
var videoID = link.match(rxVideoID)[1]
http.get("http://www.youtube.com/get_video_info?video_id="+videoID, function(res) {
var chunks = []