Skip to content

Instantly share code, notes, and snippets.

View scoates's full-sized avatar

Sean Coates scoates

View GitHub Profile
@scoates
scoates / init.lua
Last active March 6, 2023 03:47
How to end the Zoom-steals-focus-on-launch nightmare we've all been experiencing.
-- You need Hammerspoon to run this: http://www.hammerspoon.org/
-- Zoom is a focus nightmare. This script will steal focus back from Zoom for zoomBlockTime seconds, at launch.
-- If you don't switch to another app Zoom will stay active.
-- If you activate (focus) Zoom from Finder, it'll accept your focus change.
-- If you focus, say, your chat app to tell someone you've launched your Zoom meeting, focus will switch back
-- to that app every time Zoom tries to steal it. Today, it's 5 times on my machine.
zoomBlockTime = 10
zoomFocusBlocked = false
@scoates
scoates / shell.nix
Last active November 3, 2022 18:29
nix shell: swift-format on macOS/darwin with Xcode toolchain
{
pkgs ? import <nixpkgs> { },
}:
let
inherit (pkgs) stdenv lib fetchFromGitHub fetchurl unzip;
in
pkgs.mkShell {
buildInputs = [
(import ./swift-format.nix { inherit stdenv lib fetchFromGitHub fetchurl unzip; })
@scoates
scoates / 0-slow.py
Created January 24, 2022 02:11
Userspace is slow? Especially on microcontrollers
import json
import os
try:
sysname = os.uname().sysname
except AttributeError:
sysname = "micropython-darwin"
if sysname in ["esp32", "micropython-darwin"]:
@scoates
scoates / mock_neopixel.py
Created January 17, 2022 01:47
WIP of neopixel mocking
class MockNeoPixel:
SCALE = 16 # scale the imgcat (iTerm2) display by this much
def __init__(self, pin, num_pixels):
self.pin = pin
self.num_pixels = num_pixels
self.pixels = [(0, 0, 0) for i in range(self.num_pixels)]
self.config = {}
def __getitem__(self, k):
@scoates
scoates / main.cpp
Created November 12, 2021 03:42
Twinkling tree LEDs?
#include <FastLED.h>
#define NUM_LEDS 150
#define LED_PIN 25
#define BRIGHTNESS 50
#define RED 0
#define GREEN 1
#define WHITE 2
#define OFF 3
@scoates
scoates / command.sh
Last active November 3, 2021 03:22
PNG to FastLED bitmap array
SERPENTINE=1 pipenv run python img2c.py ~/Desktop/star.png > src/bitmap.h
# star.png is a 16x16 PNG file
@scoates
scoates / QCRuleSet.json
Created August 25, 2021 16:15
Assets from VaxiCode (vaccios)
{
"name": "Quebec",
"version": "1.0",
"date": "2021-07-27",
"conditions": [
{
"id": "second_dose",
"type": "Immunization",
"cvx": [
207,
@scoates
scoates / output.log
Last active November 15, 2021 14:30
Bluetooth Scale in Python (Sinocare CK-793, ETEKCITY, likely others built on the same chipset)
root@raspberrypi:~# python3 scale.py XX:RE:DA:CT:ED:XX
Connected.
152g
444g
688g
726g
783g
853g
978g
1753g
@scoates
scoates / predictions.md
Last active March 18, 2020 15:14
Financial package (and new restrict) predictions

My hope/mild-expectation for Trudeau's financial package press conference tomorrow:

  • unenforceable requirement that everyone must stay home except to get food, medicine, necessary supplies
  • all offices/churches/gyms/etc. with more than 5 people must close. Everyone (except essential services including grocery and pharmacy) encouraged to close, if more than 1.
  • no gatherings of more than 10 people (current recommendation: 50)
  • all restaurants, bars, coffee shops, etc., must do delivery/pickup only; can’t have more than 10 people working
  • fed tax deadline pushed back to June 1 (filing) + July 31 (payment) (Quebec already did this)
  • shortened EI timeline, waiver of waiting period, special circumstances to allow easier qualification, added resources to administer this
  • mortgage holiday until May 1
  • immediate stimulus cheques going out; maybe up to $1000 (everyone); treated as a tax credit
  • federal corporate tax cut for small business, more coming from provinces
@scoates
scoates / zappa_settings.json
Created September 21, 2017 06:05
Zappa asunc settings
{
"stagename": {
"async_resources": true,
"async_response_table": "dynamodb_table_name",
"async_response_table_read_capacity": 2,
"async_response_table_write_capacity": 1,
}
}