Skip to content

Instantly share code, notes, and snippets.

View alexdean's full-sized avatar

Alex Dean alexdean

View GitHub Profile
# in this test, i want to define a custom N1 segment which adds an extra element to the standard N1.
# it seems that the code somehow continues to reference the built-in N1 definition.
# i see errors saying that "N1 segment has only 6 elements" (the original number of elements in N1)
# even when my custom N1 defines 7 elements.
# see lines 103-111 below for more details on the error i see.
require "bundler/inline"
alexdean /
Last active May 14, 2021 16:04
demonstrating a problem with the OBS python method signal_handler_disconnect
import obspython as obs
obs_signal_handler = obs.obs_get_signal_handler()
# tested in OBS 25.0.6 on OSX. July 26, 2020.
def script_description():
return """
Debug signal_handler_disconnect.
video = Video.first
save_method = video.method(:save)

# => Method

# => an Array with [file, line]
alexdean /
Last active November 26, 2022 04:41
changes in ActiveModel::Dirty tracking during ActiveRecord lifecycle callbacks in rails 5.2

This script reports on how the behavior of ActiveModel::Dirty methods have changed during various lifecycle callbacks in ActiveRecord instances.

The report shows the output of various ActiveModel::Dirty methods within a number of different callbacks, under different versions of ActiveRecord.

The script used to create this output is below, and can be used/modified to get information on other dirty-state methods.

fun stuff

this script was kinda fun to put together. i got to poke in a few areas of ruby I don't typically touch.

from locust import HttpLocust, TaskSet, task
class UserBehavior(TaskSet):
def on_start(self):
""" on_start is called when a Locust start before any task is scheduled """
def on_stop(self):
""" on_stop is called when the TaskSet is stopping """
alexdean /
Last active April 25, 2018 17:36
error related to running bundler from rvm global gemset
rm -Rf /tmp/error
mkdir -p /tmp/error
cd /tmp/error
cat > Gemfile <<EOF
source ""
rvm use 2.5.1@global
gem install bundler --no-ri --no-rdoc
class TempModelBuilder
def, size)
final_table_name = "tmp_#{Digest::MD5.hexdigest(sql)}"
clazz =
clazz.table_name = final_table_name
# do stuff to create & populate the table
alexdean /
Created December 20, 2016 18:06
wunderground script for hubot
# Description:
# None
# Dependencies:
# None
# Configuration:
# HUBOT_WUNDERGROUND_USE_METRIC Set to arbitrary value to use forecasts with metric system units
alexdean /
Last active September 30, 2020 00:22
updating a youtube video with an invalid language code results in a deceptive invalidVideoMetadata error


YouTube's API will return a confusing error code if you use a language code which YT does not support.



language_code name
af Afrikaans
am Amharic
ar Arabic
arq Algerian Arabic
art-x-bork Swedish Chef
as Assamese
ast Asturian
az Azerbaijani
be Belarusian