Skip to content

Instantly share code, notes, and snippets.

View mafredri's full-sized avatar

Mathias Fredriksson mafredri

View GitHub Profile
@mafredri
mafredri / var_subshell_perf.zsh
Last active August 29, 2015 14:25
ZSH Performance: variable vs captured subshell output
#!/usr/bin/env zsh
test1() {
test_var=$1
}
test2() {
print -n $1
}
@mafredri
mafredri / subl.sh
Last active August 29, 2015 14:22
Extended subl for SublimeText to open *.sublime-project files if available.
# Detect and open sublime-project files in the provided path, if no parameters
# are provided, open the $PWD. If the parameter is not a directory, call subl
# normally.
_subl() {
local params="$*"
local project
if test -z "$params"; then
params=.
fi

Keybase proof

I hereby claim:

  • I am mafredri on github.
  • I am mafredri (https://keybase.io/mafredri) on keybase.
  • I have a public key ASAcL0fP34_ZPvJ6-aV3RbVAF8TYNpudE2uPwkxbOw2KIgo

To claim this, I am signing this object:

@mafredri
mafredri / check_connection.sh
Last active May 22, 2017 01:57
Upgrade WiFi AP (e.g on OpenWRT) when there is a stronger BSSID in vicinity (based on signal strength). Useful when you are a member of a SSID which has multiple APs under the same SSID but you don't want to commit to only one BSSID.
#!/bin/sh
COUNT=0
LIMIT=5
INTERFACE=wlan1
NAME=$(basename $0)
CLEAN_NAME=${NAME%.sh}
PID="/var/run/$CLEAN_NAME.pid"
LOGGER="logger -t $CLEAN_NAME -s"