Skip to content

Instantly share code, notes, and snippets.

View pepijndevos's full-sized avatar

Pepijn de Vos pepijndevos

View GitHub Profile
@pepijndevos
pepijndevos / run.sh
Created November 2, 2023 18:05
Automatically refactor the code in an entire github organization
#!/bin/bash
set -ex
# Define your GitHub username and organization name
YOUR_USERNAME="pepijndevos"
ORG_NAME="SciML"
# Iterate through the organization's repositories
REPO_LIST=$(gh repo list $ORG_NAME --json name --limit 1000 --no-archived)
using ControlSystems
using Plots
# calculate the inertia from bifilar pendulum experiment
# https://www.youtube.com/watch?v=IdhV3lphRcc
L = 1.8 # length of the pendulum
D = 0.18 # distance between the wires
b = D/2
g = 9.81 # graviational constant
@pepijndevos
pepijndevos / counter.hy
Created August 23, 2022 21:13
Amaranth in Hy
(import amaranth *)
(defn domain [domain #* expr] (domain.__iadd__ expr))
(defmacro mwhen [m condition #* body]
`(do
(with [(m.If ~condition)]
~body)))
(defmacro mif [m condition pos neg]
@pepijndevos
pepijndevos / schema.py
Last active August 11, 2022 12:13
Parse mapbox vector tiles with minipb on micropython
import minipb
import zlib
value = (('string_value', 'U'),
('float_value', 'f'),
('double_value', 'd'),
('int_value', 't'),
('uint_value', 'T'),
('sint_value', 'z'),
('bool_value', 'b'))
@pepijndevos
pepijndevos / patch.py
Created June 12, 2022 20:05
Gowin IDE patcher
#!/usr/bin/python3
import os
import re
import subprocess
import mmap
def patch(filename : str, bytes):
subprocess.run(["cp",filename, filename + '_patched'])
with open(filename + "_patched", "r+b") as f:
@pepijndevos
pepijndevos / randomize.sh
Last active April 10, 2022 10:09
Replace colors in an image with random ones and assemble into a montage
set -ex
ORIGINAL="fox.jpg"
OG_SHIRT="#224e2b"
OG_PANTS="#9f6e4e"
function rand {
echo $(($1 + ($RANDOM % ($2 - $1))));
}
mkdir -p tiles
@pepijndevos
pepijndevos / recruiter.txt
Last active February 15, 2022 14:19
A counter-copy-pasta for recruiter spam
We're no strangers to jobs
You know the rules and so do I
A full commitment's what I'm thinking of
You wouldn't get this from any other guy
You're just gonna tell me what you're paying
Gotta make you understand
Never gonna give my pay
Never gonna let you know
@pepijndevos
pepijndevos / wordle.py
Last active January 12, 2022 17:00
Try to play wordle optimally
choices = ["cigar", "rebut", "sissy", "humph", "awake", "blush", "focal", "evade", "naval", "serve", "heath", "dwarf", "model", "karma", "stink", "grade", "quiet", "bench", "abate", "feign", "major", "death", "fresh", "crust", "stool", "colon", "abase", "marry", "react", "batty", "pride", "floss", "helix", "croak", "staff", "paper", "unfed", "whelp", "trawl", "outdo", "adobe", "crazy", "sower", "repay", "digit", "crate", "cluck", "spike", "mimic", "pound", "maxim", "linen", "unmet", "flesh", "booby", "forth", "first", "stand", "belly", "ivory", "seedy", "print", "yearn", "drain", "bribe", "stout", "panel", "crass", "flume", "offal", "agree", "error", "swirl", "argue", "bleed", "delta", "flick", "totem", "wooer", "front", "shrub", "parry", "biome", "lapel", "start", "greet", "goner", "golem", "lusty", "loopy", "round", "audit", "lying", "gamma", "labor", "islet", "civic", "forge", "corny", "moult", "basic", "salad", "agate", "spicy", "spray", "essay", "fjord", "spend", "kebab", "guild", "aback", "motor", "alon
* schematic
Rresistor3 vcc out resistance=1000
Mnmos2 out in gnd gnd mymos w=0.001 l=0.00001
Vvsource4 in gnd dc=2 ac=1 sin(2.5 2.5 1000 )
Vvsource5 vcc gnd dc=5
ARR: 1.06%
ARR: -7.30%
ARR: 1.83%
ARR: 1.11%
ARR: 3.19%
ARR: -2.74%
ARR: -3.50%
RRR: -6.26%
RRR: 35.19%