Skip to content

Instantly share code, notes, and snippets.

View emlun's full-sized avatar

Emil Lundberg emlun

View GitHub Profile
@emlun
emlun / btsync.service
Last active September 23, 2018 00:25
Systemd service definition for user instance of BitTorrent Sync (hopefully systemd 209 compatible)
/usr/lib/systemd/user/btsync.service
------------------------------------
[Unit]
Description=Bittorent Sync service for %u
[Service]
ExecStart=/usr/bin/btsync --config %h/.config/btsync/btsync.conf --nodaemon
Restart=on-abort
[Install]
/**
* <p>
* <code>_.group(functions, [context])</code>
* </p>
* <p>
* <code>_.group(*functions)</code>
* </p>
*
* <p>
* Returns a function <code>f</code> that wraps an array of functions and
/*
Make sure Jasmine is included somehow, then declare a dependency on this module.
Usage:
expect(fn).toBeFunction()
*/
define([
'underscore',
], function(_) {
beforeEach(function() {
@emlun
emlun / README.md
Last active February 13, 2022 17:16
Journal filtering skeleton

Journal filtering skeleton

Proof of concept on how one can monkey patch any systemd service and filter its journal output.

By default, systemd services connect the executable's STDOUT to the journal. If the executable doesn't provide a way to configure its output, you're left with redirecting the output somewhere else. And since the options for redirecting systemd services' output are very limited, one of the simplest ways to do it is

@emlun
emlun / i3-shell.sh
Created August 11, 2014 15:12 — forked from viking/i3-shell.sh
#!/bin/bash
# i3 thread: https://faq.i3wm.org/question/150/how-to-launch-a-terminal-from-here/?answer=152#post-id-152
CMD=xterm
CWD=''
# Get window ID
ID=$(xdpyinfo | grep focus | cut -f4 -d " ")
# Get PID of process whose window this is
@emlun
emlun / .pentadactylrc
Last active August 29, 2015 14:07
Custom Pentadactyl command to make Stack Exchange vote buttons clickable (usable with hints mode)
group -description "Stack Exchange network" -locations=stackexchange.com,stackoverflow.com,superuser.com stackexchange
command -description "Make Stack Exchange vote buttons clickable" -group stackexchange -nargs=0 vote javascript (function() { $('.vote a').attr('href', 'javascript:void(0)'); })()
@emlun
emlun / foo.cpp
Last active August 29, 2015 14:07
C++ classes have themselves as implicit inner class
struct Foo {
int x;
Foo() : x(0) {};
explicit Foo(int x) : x(x) {};
bool operator>(const Foo& other) const {
return x > other.x;
}
};
@emlun
emlun / mkcert.sh
Last active August 29, 2015 14:08
#!/bin/bash
FILENAME="device"
KEY_FILE="${FILENAME}.key"
REQUEST_FILE="${FILENAME}.csr"
CERT_FILE="${FILENAME}.crt"
UPLOAD_FILE="tmp/${REQUEST_FILE}"
DOWNLOAD_FILE="tmp/${CERT_FILE}"
Description='eduroam'
Interface=wlp9s0 # EDIT THIS
Connection=wireless
Security=wpa-configsection
IP=dhcp
WPAConfigSection=(
'ssid="eduroam"'
'key_mgmt=WPA-EAP'
'eap=TTLS'
@emlun
emlun / keybase.md
Created February 10, 2015 01:11
keybase.md

Keybase proof

I hereby claim:

  • I am emlun on github.
  • I am emlun (https://keybase.io/emlun) on keybase.
  • I have a public key whose fingerprint is EB86 2761 6EC1 971D F076 F2FF 2BF5 FD22 FCAB DE73

To claim this, I am signing this object: