Skip to content

Instantly share code, notes, and snippets.

Avatar

Emil Lundberg emlun

View GitHub Profile
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:

View confgit.sh
#!/bin/bash
# Author: Emil Lundberg <lundberg.emil@gmail.com> <https://keybase.io/emlun>
#
# This is free and unencumbered software released into the public domain.
# See http://unlicense.org/ for the full license.
#
# Usage:
#
# $ confgit ls # List git repositories in ~/.config/
# $ confgit foo init # Clone 'foo.git' from remote into ~/.config/foo/
You can’t perform that action at this time.