Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am ema on github.
  • I am emaman (https://keybase.io/emaman) on keybase.
  • I have a public key whose fingerprint is 9545 9696 1928 1C17 FFAC 5891 D508 5A07 50FD B7A3

To claim this, I am signing this object:

root@orion:/etc/acpi# cat /etc/acpi/events/fucking-headphones-plugged-in
# Fucking headphones man
event=jack/headphone HEADPHONE plug
action=/etc/acpi/fucking-headphones-plugged-in.sh
root@orion:/etc/acpi# cat /etc/acpi/fucking-headphones-plugged-in.sh
#!/bin/sh
# 2 is not pulled out of my ass. See `pactl list short sinks`.
su ema -c 'pactl list short sink-inputs | while read x y ; do pactl move-sink-input $x 2; done'
@ema
ema / sp
Last active October 9, 2016 05:34 — forked from wandernauta/sp
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/bin/bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@ema
ema / vkncsa.py
Created March 8, 2016 15:57
varnishkafka prototype in python
#!/usr/bin/python
# Usage: vkncsa [conffile]
"""varnishkafka prototype using varnishncsa"""
import re
import os
import sys
import shlex
import socket
.LC0:
.string "Iteration %ld\n"
.text
.globl main
.type main, @function
main:
xor %rbx, %rbx
loop:
# Call printf
@ema
ema / vlc-download-subs.diff
Created October 12, 2011 11:12
Lua VLC extension to download subtitles: dirty hack to wget the subtitles file
--- /home/ema/.local/share/vlc/lua/extensions/141787-subtitles-mod.lua 2011-09-09 18:13:22.000000000 +0200
+++ 141787-subtitles-mod.lua 2011-10-12 13:06:35.470947422 +0200
@@ -430,6 +430,12 @@
end
--vlc.msg.dbg("[Subtitles] Subtitle data: "..dataBuffer)
+ local subsfilename = "/tmp/\""..vlc.input.item():name()..".srt.zip\""
+
+ -- http://www.opensubtitles.org/en/subtitleserve/sub/3476865
+ vlc.msg.info("[Subtitles] Downloading this subs from: "..url.." to "..subsfilename)
@ema
ema / debian-usb-stick.sh
Created October 9, 2011 18:52
Write the Debian installer to a USB stick
wget http://tinyurl.com/debian-squeeze-mini-iso -O /dev/sdb ; sync
@ema
ema / 141787-subtitles-mod.lua
Created September 2, 2011 12:27
VLC extension to find and download subtitles
--[[
Subtitles
Copyright © 2009-2011 VideoLAN and AUTHORS
Authors: ale5000 (Based on the script made by Jean-Philippe André)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or