Skip to content

Instantly share code, notes, and snippets.

View bdd's full-sized avatar
♨️

Berk D. Demir bdd

♨️
View GitHub Profile
@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
#!/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}" \
### 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 / 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
@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 / 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
#!/usr/bin/env python
import sys
import socket
import argparse
import BaseHTTPServer
from threading import Thread, Timer
class BasicServer(BaseHTTPServer.BaseHTTPRequestHandler):
@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
@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