Skip to content

Instantly share code, notes, and snippets.

View edykim's full-sized avatar

Edward Kim edykim

View GitHub Profile
# pip3 install pymupdf
import fitz # PyMuPDF
import sys
input_path = sys.argv[1]
output_path = sys.argv[2]
TARGET_RATIO = 1488 / 2266 # ≈ 0.6569 (portrait iPad Mini 7)
@edykim
edykim / programming-as-theory-building.md
Created July 4, 2025 04:06 — forked from onlurking/programming-as-theory-building.md
Programming as Theory Building - Peter Naur

Programming as Theory Building

Peter Naur

Peter Naur's classic 1985 essay "Programming as Theory Building" argues that a program is not its source code. A program is a shared mental construct (he uses the word theory) that lives in the minds of the people who work on it. If you lose the people, you lose the program. The code is merely a written representation of the program, and it's lossy, so you can't reconstruct

@edykim
edykim / template.js
Last active March 7, 2024 18:58
template function using string literals
"use strict";
function template(html) {
return function parse(context) {
const keys = Object.keys(context);
const params = keys.map(k => context[k]);
return new Function(
...keys,
'return (`' + html + '`)')
(...params);
@edykim
edykim / gist:a1b578e6ad646eea1a41e5e1a46f69ae
Created December 29, 2023 00:39
delete quarantine attribute on downloaded files on mac
$ xattr -d -r com.apple.quarantine <file_path>
@edykim
edykim / ansi.c
Last active December 8, 2023 21:08
cmd + mission control key (show desktop) on QMK
// register custom keycodes
enum custom_keycodes {
// ...
MAC_TASK,
// ...
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
// ...
switch (keycode) {
@edykim
edykim / canvas.html
Created April 7, 2023 05:25
low latency canvas and predicted events
<!DOCTYPE html>
<html lang="en">
<head>
<style>
* {
touch-action: none;
}
canvas {
width: 600px;
height: 600px;
@edykim
edykim / collection.php
Last active August 30, 2022 04:47
a typed collection with phpstan
<?php declare(strict_types=1);
interface Spaceship
{
}
interface Car
{
}
@edykim
edykim / zoom-nav.js
Last active September 26, 2021 19:03
Zoom keyboard navigation extension
// ==UserScript==
// @name Zoom arrow key/space navigation
// @namespace https://edykim.com/
// @version 0.1
// @description Drag and drop on the quick links bar on the top.
// @author edykim
// @match https://*.zoom.us/*
// @icon https://www.google.com/s2/favicons?domain=zoom.us
// @grant none
// ==/UserScript==
@edykim
edykim / assignment_highlights.js
Created June 7, 2021 20:31
Status highlights for assignments on Canvas
// ==UserScript==
// @name Add status highlights for assignments on Canvas
// @version 0.1
// @include https://canvas.instructure.com/courses/*/assignments
// @author edykim
// @grant none
// ==/UserScript==
(function () {
function install_status_marker(window, $) {
"use strict";
#!/usr/bin/python
import sys
from PyPDF2 import PdfFileWriter, PdfFileReader
filename = sys.argv[1]
newFilename = filename.replace(".pdf", ".cropped.pdf")
trimWidth = 65
trimHeight = 35