Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
@khchanel
khchanel / myip
Created December 29, 2014 09:11
simple command line tool that shows your current WAN IP address
#!/bin/sh
curl https://ip-detector.herokuapp.com/api/ip
@khchanel
khchanel / cowsayfortune
Created June 2, 2015 02:43
fortune telling with random cowsay
#!/bin/bash
# cowsayfortune
# Author: Nelson Chan <khchanel>
#
# fortune telling with random cowsay
# change paths accordingly for your system
FORTUNE="/usr/local/Cellar/fortune/*/bin/fortune"
COWSAY="/usr/local/Cellar/cowsay/*/bin/cowsay"
SHUF="/usr/local/Cellar/coreutils/*/bin/gshuf"
import pyzbar.pyzbar as pyzbar
import cv2
def detectBarcodes(img):
codes = pyzbar.decode(img)
for code in codes:
print(f'type={code.type}')
print(f'data={code.data}')
return codes
@khchanel
khchanel / gensecret.sh
Created July 3, 2025 13:02
generate 256 bit random string useful for HS256
#!/bin/sh
openssl rand -base64 32