Skip to content

Instantly share code, notes, and snippets.

Avatar

Emil Lundberg emlun

View GitHub Profile
@emlun
emlun / btsync.service
Last active Sep 23, 2018
Systemd service definition for user instance of BitTorrent Sync (hopefully systemd 209 compatible)
View btsync.service
/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]
View underscore.group.js
/**
* <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
View gist:e7306ef16d92a9bca634
/*
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 Aug 29, 2015
Journal filtering skeleton
View README.md

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

View 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 Aug 29, 2015
Custom Pentadactyl command to make Stack Exchange vote buttons clickable (usable with hints mode)
View .pentadactylrc
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 Aug 29, 2015
C++ classes have themselves as implicit inner class
View foo.cpp
struct Foo {
int x;
Foo() : x(0) {};
explicit Foo(int x) : x(x) {};
bool operator>(const Foo& other) const {
return x > other.x;
}
};
View mkcert.sh
#!/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}"
View eduroam.wifi
Description='eduroam'
Interface=wlp9s0 # EDIT THIS
Connection=wireless
Security=wpa-configsection
IP=dhcp
WPAConfigSection=(
'ssid="eduroam"'
'key_mgmt=WPA-EAP'
'eap=TTLS'
View 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:

You can’t perform that action at this time.