Skip to content

Instantly share code, notes, and snippets.

View JohnDDuncanIII's full-sized avatar

John Duncan JohnDDuncanIII

View GitHub Profile
update_go() {
ARCH="$(uname -m | sed 's/^..86$$/386/; s/^.86$$/386/; s/x86_64/amd64/; s/arm.*/arm/; s/aarch64/arm64/')"
OS="$(uname | tr "[:upper:]" "[:lower:]" | sed 's/mingw/windows/; s/.*windows.*/windows/')"
# if the $GOROOT environment variable does not exist...
if [ -z "$GOROOT" ]
then
# if go is installed
if [ -x "$(command -v go)" ]
then
@binji
binji / LICENSE
Last active January 9, 2025 20:55
pokegb.cc w/o macros
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
<!DOCTYPE html>
<iframe src="data:text/html,
<!DOCTYPE html>
<script>
const d = new Date();
const year = d.getFullYear();
const month = `${d.getMonth() + 1}`.padStart(2, '0');
const day = `${d.getDate()}`.padStart(2, '0');
@prologic
prologic / LearnGoIn5mins.md
Last active August 12, 2025 02:24
Learn Go in ~5mins
@ityonemo
ityonemo / test.md
Last active August 19, 2025 14:21
Zig in 30 minutes

A half-hour to learn Zig

This is inspired by https://fasterthanli.me/blog/2020/a-half-hour-to-learn-rust/

Basics

the command zig run my_code.zig will compile and immediately run your Zig program. Each of these cells contains a zig program that you can try to run (some of them contain compile-time errors that you can comment out to play with)

document.createElementHTML = element => document.createElementNS("http://www.w3.org/1999/xhtml", element)
document.createElementXUL = element => document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", element)
htmlNS = () => document.createElement = document.createElementHTML
// https://bugzilla.mozilla.org/show_bug.cgi?id=1479050
// https://bugzilla.mozilla.org/show_bug.cgi?id=1479538
// https://bugzilla.mozilla.org/show_bug.cgi?id=1631439
// https://developer.thunderbird.net/add-ons/updating/tb78/changes#changed-xul-elements
xulNS = () => document.createElement = (
// Mozilla 63+
@gullyn
gullyn / flappy.html
Last active January 24, 2025 00:41
Flappy bird in 205 bytes (improved!)
<body onload=z=c.getContext`2d`,setInterval(`c.width=W=150,Y<W&&P<Y&Y<P+E|9<p?z.fillText(S++${Y=`,9,9|z.fillRect(p`}*0,Y-=--M${Y+Y},P+E,9,W),P))):p=M=Y=S=6,p=p-6||(P=S%E,W)`,E=49) onclick=M=9><canvas id=c>
// js
const isDarkMode = (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches
)
window
.matchMedia("(prefers-color-scheme: dark)")
.addEventListener("change", e => {
const colorScheme = e.matches ? "dark" : "light"
@riobard
riobard / tcpdump.txt
Last active August 12, 2022 08:19
Poem lines broadcast by my ISP-provided fiber optical modem
# My ISP-provided fiber optical modem broadcasts a line of a poem every ten seconds. Here's the tcpdump of the complete poem.
# The optical modem is made by Shanghai Nokia-Bell Co.,Ltd and its model number is G-140W-UD. It's provided by my ISP, China Unicom in Shenzhen.
$ tcpdump -i vlan10 ether proto 0x8300
15:59:00.720301 00:00:00:00:00:12 (oui Ethernet) > Broadcast, ethertype Unknown (0x8300), length 72:
0x0000: 0000 0000 e4ea 8386 d93c 5468 6520 6461 .........<The.da
0x0010: 7920 4920 6c6f 7374 206d 7920 7665 7279 y.I.lost.my.very
0x0020: 2066 6972 7374 2074 6f6f 7468 2c00 0000 .first.tooth,...
0x0030: 0000 0000 0000 0000 0000 ..........
15:59:10.740778 00:00:00:00:00:12 (oui Ethernet) > Broadcast, ethertype Unknown (0x8300), length 72:
@tekin
tekin / .gitattributes
Last active July 2, 2025 17:00
An example .gitattributes file that will configure custom hunk header patterns for some common languages and file formats. See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details.
# Stick this in your home directory and point your Global Git config at it by running:
#
# $ git config --global core.attributesfile ~/.gitattributes
#
# See https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more for more details
*.c diff=cpp
*.h diff=cpp
*.c++ diff=cpp
*.h++ diff=cpp