Skip to content

Instantly share code, notes, and snippets.

@DeflateAwning
DeflateAwning / PCB_Ordering_Checklist.md
Last active August 31, 2024 04:52
A KiCAD (or generic) PCB ordering checklist

PCB Ordering Checklist

Main Checklist

  1. Printed PCB to check footprints?
  2. STM32CubeIDE entry, if applicable.
  3. Revision and date?
  4. Organization logo?
  5. Electrical Rules Check
  6. Design Rules Check
  7. Update revision and date in schematic and PCB pages.
@DeflateAwning
DeflateAwning / polars_upgrade_regex_magic.md
Created August 1, 2024 21:17
Polars Upgrade Regex Magic

Sometimes the Python Polars library upgrades.

The following are some codebase migrations I've used.

Pre-v0.20.x

  1. Find+Replace: pl.Utf8 -> pl.String

v0.20.31 to v1.x

@DeflateAwning
DeflateAwning / sympy_solve_example.py
Created March 29, 2024 22:19
An example of using Sympy
from sympy import symbols, Eq, solve
# Define symbols
k1, k2, k3 = symbols('incoming_slope normal_slope outgoing_slope')
# Define the equation
equation = Eq((k1 - k2) / (1 + (k1*k2)), (k2 - k3) / (1 + (k2*k3)))
# Solve the equation for k3
solution = solve(equation, k3)
@DeflateAwning
DeflateAwning / send_keyboard_to_virtualbox.py
Created March 6, 2024 22:48
Send text to a running VirtualBox instance via the keyboard. No Guest Additions required.
# pip install virtualbox
import virtualbox
vbox = virtualbox.VirtualBox()
machine = vbox.find_machine("Ubuntu 20")
session = machine.create_session()
session.console.keyboard.put_keys("Hello, world!")
# Source: https://github.com/sethmlarson/virtualbox-python/issues/142
@DeflateAwning
DeflateAwning / Set GitHub Page Title to the Filename.user.js
Created January 26, 2024 22:46
When browsing a GitHub project, set the <title> to the filename (instead of the whole folder path)
// ==UserScript==
// @name Set GitHub Page Title to the Filename
// @namespace https://gist.github.com/DeflateAwning
// @version v0.1
// @description When browsing a GitHub project, set the <title> to the filename and repo user/name.
// @author DeflateAwning
// @match https://github.com/*/*/blob/**
// @icon https://www.google.com/s2/favicons?sz=64&domain=github.com
// @grant none
// ==/UserScript==
@DeflateAwning
DeflateAwning / Teams - AccountName.desktop
Created January 10, 2024 17:22
Teams for Linux - Multiple User Accounts
#!/usr/bin/env xdg-open
[Desktop Entry]
Name=Teams Account - AccountName
Exec=teams-for-linux --appTitle "Teams - AccountName" --customUserDir="/home/user/.teams-data/account_AccountName"
Terminal=false
PrefersNonDefaultGPU=false
Icon=teams-for-linux
Type=Application
# place this file in ~/Desktop and/or ~/.local/share/applications/ (to add to the start menu)
@DeflateAwning
DeflateAwning / AWS Batch Upgrades.user.js
Last active August 6, 2024 17:38
Tampermonkey script to modify the AWS Batch run page to add an execution time field to the "Job attempts" tab
// ==UserScript==
// @name AWS Batch Upgrades
// @namespace https://gist.github.com/DeflateAwning/d8d42a082cb27b7d01df751d0dc26f31
// @version 0.2.5
// @description Calculate AWS Batch job time since started and total execution time (on the "Job attempts" tab). Set the tab title to include the job name and execution status. Fix the bug where you logout and lose the job you had open.
// @author DeflateAwning
// @match https://*.console.aws.amazon.com/batch/home?*
// @grant none
// ==/UserScript==
@DeflateAwning
DeflateAwning / calling_var_name.py
Created August 1, 2023 17:19
A simple python function to get the name of a variable from a calling scope
def calling_var_name(obj) -> str:
""" Returns the name of the variable that was passed in. """
caller_frame = inspect.currentframe().f_back.f_back
while hasattr(caller_frame, 'f_locals'):
list_of_obj_names = ([name for name, value in caller_frame.f_locals.items() if value is obj])
if len(list_of_obj_names) > 0:
return list_of_obj_names[0]
{
"packages": [
{
"name": "ATTinyCore",
"maintainer": "Spence Konde",
"websiteURL": "https://github.com/SpenceKonde/ATTinyCore",
"email": "",
"help": {
"online": ""
},
@DeflateAwning
DeflateAwning / pixieset-scrape.js
Last active May 18, 2024 08:58 — forked from antiops/pixieset-scrape.js
pixieset.com dumper
/* pixieset.com full size image scraper
*
* Rips all images in highest quality
*
* To use, scroll to the very bottom of the album and press F12 then paste the below snippet in and press enter.
* The full file list will be copied to your clipboard. You can use jdownloader to easily download the full list.
*/
(() => {
const data = document.querySelectorAll('img')