Skip to content

Instantly share code, notes, and snippets.

View Thomascountz's full-sized avatar

Thomas Countz Thomascountz

View GitHub Profile
Thomascountz / laser_cut_test_card.svg
Created December 5, 2023 19:06
Laser Cut Test Card
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Thomascountz /
Last active October 25, 2023 13:43
AsyncHttpClient is an asyncio-based MicroPython library, designed for asynchronous, concurrent HTTP/HTTPS requests to avoid blocking the execution of other coroutines.
# v0.1
import usocket as socket
import ussl
import uasyncio as asyncio
import ujson as json
from utime import ticks_ms, ticks_diff
class AsyncHttpClient:
Thomascountz /
Created August 7, 2023 01:23
Closures in Ruby

🚀 Let's explore Closures in #Ruby with a space-themed example! 🌌 #ThomasTip

Closures are functions/methods that can be invoked from other functions or methods, while retaining access to variables from their original scope.

def launch_sequence(seconds)
  start =
  -> do
    elapsed = - start
 remaining = seconds - elapsed.round
Thomascountz / hash_struct_data_class_benchmark.rb
Created August 4, 2023 18:45
Ruby Hash v. Struct v. Data v. Class
require 'benchmark/ips'
PointStruct =, :y, :grayscale)
PointData = Data.define(:x, :y, :grayscale)
class PointClass
attr_accessor :x, :y, :grayscale
def initialize(x, y, grayscale)
Thomascountz /
Last active April 21, 2023 11:53
Creating a new Rails app using locally checked-out code.
# Fork rails/rails on Github
> git clone gem
Cloning into 'rails'...
> cd rails
# Checkout SHA prior to the merge commit and create a new branch
> git checkout -b practice-pr-46683 59fe981^
Switched to a new branch 'practice-pr-46683'
Thomascountz /
Created September 14, 2022 12:50

This is an example of selecting * that will need to execute for more than the set timeout of 1ms.

mysql> select * /*+ MAX_EXECUTION_TIME(1) */ from test_table;
ERROR 3024 (HY000): Query execution was interrupted, maximum statement execution time exceeded

mysql> select thread_id,event_name,sql_text,digest_text,current_schema,mysql_errno,returned_sqlstate,message_text,errors from performance_schema.events_statements_history where mysql_errno = 3024 limit 1\G
*************************** 1. row ***************************
        thread_id: 345
       event_name: statement/sql/select
Thomascountz /
Last active August 22, 2022 08:23
Addition operation on a Value object
graph LR
    A["A | data: 1.0"]
    B["B | data: 2.0"]
    C["C | data: 3.0"]
    A --> APlus
    B --> APlus
    APlus --> C
Thomascountz / sixth_export.rb
Created June 28, 2022 08:00
Lo-fi inspired piece written programmatically with Sonic Pi
use_bpm 68
kicks = "/Users/thomas.countz/Sync/Lunar/Drum Shots/Kicks"
snares = "/Users/thomas.countz/Sync/Lunar/Drum Shots/Snares"
live_loop :click do
sleep 1
live_loop :hiss, sync: :click do
sample :vinyl_hiss, amp: 0.3, beat_stretch: 5, rpitch: -8
Thomascountz / third_export.rb
Created June 27, 2022 21:59
Lo-fi Piece written programmatically with Sonic Pi
# Listen here:
use_bpm 68
kicks = "/Users/thomas.countz/Sync/Lunar/Drum Shots/Kicks"
snares = "/Users/thomas.countz/Sync/Lunar/Drum Shots/Snares"
live_loop :click do
sleep 1