Skip to content

Instantly share code, notes, and snippets.

View bdd's full-sized avatar
♨️

Berk D. Demir bdd

♨️
View GitHub Profile
@bdd
bdd / aprs-is-passcode-gen.py
Last active January 25, 2024 18:27
APRS-IS passcode generator
#!/usr/bin/env python3
from itertools import zip_longest
from functools import reduce
def code(callsign):
"""Return APRS-IS passcode for callsign
Based on aprsc's implementation at https://git.io/vrGXL
@bdd
bdd / apu2-leds.sh
Last active January 21, 2024 21:43
PC Engines apu2 LEDs
#!/usr/bin/env bash
set -euo pipefail
ltab=(
1/brightness=1
2/trigger=disk-activity
3/trigger=netdev
3/device_name=enp1s0
3/link=1
3/tx=1
@bdd
bdd / quickfiles
Last active April 15, 2023 13:54
FZF_DEFAULT_COMMAND utility for fzf
#!/bin/bash
# FZF_DEFAULT_COMMAND utility for fzf
#
# Tries to use Watchman, Ripgrep (rg), The Silver Searcher (ag) in this order.
# ...or falls back the fzf's Unix default.
#
# TODO:
# - Use 'git ls-files -cmod' in Git repositories
#!/usr/bin/env bash
set -euo pipefail
(($# == 2)) || (echo "usage: $0 <instance> <user>" >&2; exit 64)
instance=$1 user=$2
next="https://${instance}/users/${user}/followers?page=1"
while [[ ${next} != "null" ]]; do
readarray -t urls < <(
curl -SsfH 'accept: application/activity+json' "${next}" \
@bdd
bdd / reset-auth.zsh
Last active July 28, 2022 15:32
Reset SSH agent socket and Kerberos credentials cache environment variables.
# -*- mode: shell-script -*-
#
# reset-auth.zsh
#
# When reattaching to a tmux (or screen session) authentication forwarding and
# delegation environment variables needs to be reset.
#
# Shell functions below can reset forwarded SSH Agent socket and Kerberos
# credentials cache environment variables by discovering and testing validity
# (ssh-agent only) on the remote machine.
@bdd
bdd / DefaultKeyBinding.dict
Last active December 5, 2021 20:37
My Cocoa key bindings (in addition to defaults).
{
/* Additional Emacs bindings:
*
* "<key combination>" = "functionName:";
*
* Key Modifiers:
* ^: ctrl
* ~: option
* $: shift
* @: command
# cat /proc/cpuinfo | grep "^processor" | wc -l
16
# cat /proc/cpuinfo | grep "^model name" | head -1
model name : Intel(R) Xeon(R) CPU E5520 @ 2.27GHz
# openssl speed md5
Doing md5 for 3s on 16 size blocks: 3787525 md5's in 3.00s
Doing md5 for 3s on 64 size blocks: 3016201 md5's in 3.00s
Doing md5 for 3s on 256 size blocks: 1856180 md5's in 3.00s
@bdd
bdd / pbkdf2.c
Last active August 18, 2021 19:43
Generate a key from a passpharse w/ PBKDF2
/*
* Copyright (c) 2011 Berk D. Demir <bdd@mindcast.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
### Keybase proof
I hereby claim:
* I am bdd on github.
* I am bdd (https://keybase.io/bdd) on keybase.
* I have a public key ASDwQaLM40WJkS-ZhAZTww7f8EkKjkJBWcs5lX9-2xhucAo
To claim this, I am signing this object:
@bdd
bdd / gcb
Last active December 29, 2015 07:29 — forked from evnm/gcb
a shorter, faster and a bit more helpful version of gcb.sh
#! /bin/sh
match=`git rev-parse --abbrev-ref --branches="*$1*"`
case `wc -w <<< "$match" | tr -d ' '` in
"0") echo "error: '$1' did not match any branch." 2>&1 ;;
"1") git checkout $match ;;
*) echo "error: '$1' is ambigious among:\n$match" 2>&1
esac