I hereby claim:
- I am vilhalmer on github.
- I am vilhalmer (https://keybase.io/vilhalmer) on keybase.
- I have a public key ASCFa936SL7xvlDDmKQQsOS2b22vRkVQPDwGT2c0N-FrGgo
To claim this, I am signing this object:
#!/usr/bin/env bash | |
# Bless jq, it even does the math for us | |
swaymsg "[con_id=$(swaymsg -t get_tree | jq "recurse(.nodes[]; .nodes) | .nodes | select(any(.focused)) | .[$1-1].id")]" focus |
#!/usr/bin/env bash | |
pid=$(cat /proc/*/stat 2>/dev/null | awk '{if ($4 == focused_pid) { print $1 }}' focused_pid="$(swaymsg -t get_tree | jq 'recurse(.nodes[]?) | select(.focused).pid')") | |
directory=$(readlink "/proc/$pid/cwd") | |
swaymsg "exec 'cd $directory; exec \$term'" |
#!/bin/env bash | |
device=$(bluetoothctl paired-devices | grep -iE "$1" | cut -d' ' -f2) | |
if [[ -n $2 ]]; then | |
command=$(bluetoothctl help | cut -d' ' -f1 | grep -iE "$2" | head -n1 | perl -pe 's/\e([^\[\]]|\[.*?[a-zA-Z]|\].*?\a)//g') | |
else | |
command="connect" | |
fi | |
echo "Command: bluetoothctl $command $device" |
#!/usr/bin/env zsh | |
# Poor soul's `docker-machine env` equivalent using ssh forwarding. | |
# Assumes that the remote docker is listening on tcp://127.0.0.1:2375. | |
LOCAL_DOCKER_PORT=${LOCAL_DOCKER_PORT:-22375} | |
pidfile="/var/run/user/$(id -u)/docker-forward-session.pid" | |
existing_session=$(cat $pidfile 2>/dev/null) | |
if [[ $1 == stop ]]; then |
#!/usr/bin/env zsh | |
set -o pipefail | |
pending=$(checkupdates) | |
printf '%s\n' "${pending[@]}" | |
pending_names=( $(echo $pending | cut -d' ' -f1) ) | |
ignores=( $(pacconf IgnorePkg) ) |
{ | |
"global": { | |
"check_for_updates_on_startup": true, | |
"show_in_menu_bar": false, | |
"show_profile_name_in_menu_bar": false | |
}, | |
"profiles": [ | |
{ | |
"complex_modifications": { | |
"parameters": { |
#!/usr/bin/env bash | |
if [[ $EUID -ne 0 ]]; then | |
# Find this script in the filesystem so we can re-run it. (There are probably better ways of doing this.) | |
self="$(cd $(dirname $(pwd -P)/${BASH_SOURCE[0]}) && pwd -P)/$(basename ${BASH_SOURCE[0]})" | |
admin_prompt="Hax requires root plz" | |
exec 10>&1 11>&2 # Copy stdout and stderr so we can bypass osascript's control of the terminal. | |
osascript -e "do shell script \"$self >&10 2>&11\" \ |
#!/usr/bin/env python | |
from __future__ import print_function | |
import os | |
from sys import argv, exit | |
import re | |
from time import sleep | |
import requests |
I hereby claim:
To claim this, I am signing this object:
typedef BOOL (^ FilterBlock)(id _); | |
@implementation NSArray (Bifurcate) | |
- (void)bifurcate:(FilterBlock)test passing:(out NSArray **)passing failing:(out NSArray **)failing | |
{ | |
NSMutableArray * passed = [NSMutableArray array]; | |
NSMutableArray * failed = [NSMutableArray array]; | |
for (id thing in self) { |