Skip to content

Instantly share code, notes, and snippets.

@ggorlen
ggorlen / README.md
Created September 19, 2021 14:28
energy audit 2021

energy audit 2021

  • computers:
    • asus:
      • burst: 40
      • normal usage: 25-40
      • on but wifi off/screen dimmed: 22
      • off: 0.6
      • sleeping: 2
  • charging: 40-85
@ggorlen
ggorlen / movie-log.md
Last active April 2, 2026 06:04
movie log
@ggorlen
ggorlen / host.pd
Last active January 12, 2022 19:36
Controlling PD with a socket
#N canvas 116 315 450 300 12;
#X obj 48 90 route start stop;
#X obj 82 170 dac~;
#X obj 39 119 noise~;
#X obj 82 143 *~ 0;
#X msg 134 118 0, f 1;
#X msg 90 117 0.5;
#X obj 221 103 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X text 160 42 0 for tcp \, see [help];
@ggorlen
ggorlen / exchange_sort.py
Last active January 27, 2022 00:39
exchange sort: the simplest sorting algorithm
# https://arxiv.org/pdf/2110.01111.pdf
def exchange_sort(A):
for i in range(len(A)):
for j in range(i + 1, len(A)):
if A[i] > A[j]:
A[i], A[j] = A[j], A[i]
def exchange_sort_improved(A):
for i in range(1, len(A)):
@ggorlen
ggorlen / ffmpeg.md
Last active May 16, 2022 02:15
ffmpeg resources

ffmpeg

This is an unorganized dump of resources I've looked at for ffmpeg.

ffmpeg  -i ./example_image/outputfinal.gif -i ./example_image/qrborder.gif  -filter_complex "fps=24.999999999999996,overlay=0:0,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" D:/webbsites/seapad/adapter/finaloutput.gif

ffmpeg -i initialimage.gif -filter:v "setpts=(newdurationinMSeconds / initialDuration)*PTS" out.gif
@ggorlen
ggorlen / index.c
Created May 8, 2022 23:38
sdl2 + emscripten
// emcc -s USE_SDL=2 index.c -o index.html
// For images, see https://lyceum-allotments.github.io/2016/06/emscripten-and-sdl2-tutorial-part-4-look-owl/
// See also https://github.com/paked/sdl2-cmake-emscripten/blob/master/src/main.cpp
#include <emscripten.h>
#include <SDL2/SDL.h>
SDL_Surface *screen;
SDL_Window *window;
SDL_Renderer *renderer;
@ggorlen
ggorlen / ttt.js
Last active January 14, 2025 15:23
tic tac toe with the monte carlo method in js
class TicTacToe {
constructor() {
this.x = 0; // 0b0xxx0xxx0xxx
this.o = 0; // 0b0ooo0ooo0ooo
this.str = new Array(9).fill(0).map((e, i) => i);
this.ply = 0;
}
copy() {
const ttt = new TicTacToe();
@ggorlen
ggorlen / codewars-tagger.js
Last active August 26, 2023 18:25
codewars tagger
// This script programmatically adjusts tags on Codewars kata
// list of untagged kata: https://www.codewars.com/kata/search?untagged
const puppeteer = require("puppeteer"); // ^20.2.0
let browser;
(async () => {
////////////////////////////////////////////////////////////////////
// SETUP STEP 1: Set headless: false temporarily and log in manually.