Skip to content

Instantly share code, notes, and snippets.

tcaddy / Gemfile
Created January 9, 2024 23:50 Webhook validation in Ruby
source ""
gem "functions_framework", "~> 1.4"
tcaddy /
Created August 29, 2022 01:55
BirdNet Pi Setup


This is an explanation of my BirdNET-Pi ( hardware installation.


The idea is to have minimal hardware outdoors (a microphone) and keep the rest indoors where it is easier to manage and keep climate controlled. I had an existing CAT5 cable running from my computer area to an outdoor telco box. It was used for an old DSL install. I used the telco box to house a CAT5-to-XLR adapter and most of an XLR omnidirectional lavalier microphone, with the tip of

tcaddy /
Last active September 23, 2020 19:53
# See
gateway=$(route -n | grep 'UG[ \t]' | awk '{print $2}')
echo "Pinging Gateway IP: $gateway"
echo "Press CTRL + C to cancel"
ping $gateway
tcaddy / folderify_mp3s.rb
Created August 20, 2020 20:57
Put mp3s in folders based on id3 tags for artist and album. Create filenames based on disk #, track #, and title from id3 tags.
#!/usr/bin/env ruby
require 'fileutils'
require 'id3tag'
require 'pry'
class FolderifyMp3s
REGEX = /\(|\)|\/|\\/.freeze
def call
tcaddy / example.rb
Created October 25, 2019 18:12
GMail usage example
callback = lambda do |result, err|
if err
# handle error
require_relative './mail'
mail =
tcaddy / .gitconfig
Created May 9, 2018 18:10
dot files
# This is Git's per-user configuration file.
# Please adapt and uncomment the following lines:
name = Firstname Lastname
email =
ui = auto
autosquash = true
tcaddy / freeze_benchmark.rb
Last active October 12, 2017 19:52
Benchmark String#freeze
#!/usr/bin/env ruby
# Based on
# but for Ruby 1.9.3
require 'benchmark'
class FreezeBenchmark
FROZEN = 'FROZEN'.freeze
def self.init(n = 100000)
tcaddy / script.bat
Last active May 23, 2017 15:19
BAT file to copy files and make a ZIP archive
SET DIRTOZIP="%TEMP%\_A%time::=.%"
COPY /B /V /Z "source" "destination"
tcaddy / aes-128-ecb.rb
Created March 8, 2017 16:15
Ruby AES-128-ECB encryption / decryption example. This was written to interface with a 3rd party that required string parameters to be encrypted the following way: Rinndael cipher, Electronic Code Block mode (ECB), no padding, encrypted buffer should be padded with spaces such that its length is divisible by 32.
# setup some input parameters
encrypted_decrypted = 'some string to encrypt or decrypt'
action = :encrypt # set to :encrypt or :decrypt
secret_key = 'abc123' # define shared secret key here
# encryption / decryption code...
cipher ='AES-128-ECB')
if action == :decrypt
cipher.key = [secret_key].pack('H*')
cipher.padding = 0
tcaddy / ping_gateway.ps1
Last active November 30, 2016 04:00
PowerShell Script to ping the gateway constantly at intervals below 1000 milliseconds so that flaky wireless connections stay alive.
# This script will let you ping in intervals less than 1 second
$ip4_gateway = (Get-WmiObject -Class Win32_IP4RouteTable | where { $_.destination -eq '' -and $_.mask -eq ''} | Sort-Object metric1 | select nexthop).nexthop
$target = $ip4_gateway # target host
$interval = 200 # in milliseconds
function Ping-It() {
$success = 0 # initialize as zero
$failure = 0 # initialize as zero
$cumaltive_time = 0 # initialize as zero