Skip to content

Instantly share code, notes, and snippets.

View andrewzah's full-sized avatar
🍊
currently working on Korean educational tools.

Andrew Zah andrewzah

🍊
currently working on Korean educational tools.
View GitHub Profile
@andrewzah
andrewzah / default.nix
Created July 12, 2025 16:25
build dotnet 8 project
{
pkgs,
lib,
stdenv,
fetchFromGitHub,
buildDotnetModule,
dotnetCorePackages,
...
}:
buildDotnetModule rec {
@andrewzah
andrewzah / default.nix
Last active November 24, 2024 09:46
pulpcore
{ pkgs ? import <nixpkgs>{}
, fetchFromGitHub ? pkgs.fetchFromGitHub
, fetchPypi ? pkgs.fetchPypi }:
let
importlib-metadata_6_0_1 = pkgs.python311.pkgs.importlib-metadata.overridePythonAttrs (old: rec {
pname = "importlib-metadata";
version = "6.0.1";
src = fetchPypi {
pname = "importlib_metadata";
inherit version;
@andrewzah
andrewzah / p1.rb
Created December 6, 2023 00:53
advent of code 2023 - day 5 - cpu go brrr
lines = File.read("input.txt").split("\n\n")
seeds = lines[0].split(": ").last.split(" ").map(&:to_i)
mappings = lines[1..].map{|line|
elems = line.split("\n")
name = elems[0].split(" ").first
entries = []
elems = elems[1..].each do |str|
dest, src, range = str.split(" ").map(&:to_i)
@andrewzah
andrewzah / part1.rb
Last active December 4, 2023 06:18
advent of code 2023 - day 4
data = File
.readlines("input.txt")
.map{|line|
_, b = line.split(": ")
b.strip.split(" | ")
}
.map{|sides| sides.map{|side| side.split.map{|s| s.to_i}}}
.each_with_index
.map{|(winning_nums, potential_nums), idx|
[idx+1, potential_nums & winning_nums]
@andrewzah
andrewzah / part1.rb
Created December 3, 2023 09:01
advent of code 2023 - day 3
lines = File
.readlines("input.txt")
.map{|l| l.strip }
@arr_length_bound = lines.length - 1
@arr_width_bound = lines[0].chars.length - 1
@array = lines.map{|l| l.chars}
@valid_nums = []
@andrewzah
andrewzah / part1.rb
Last active December 2, 2023 08:34
advent of code 2023 - day 2 (ruby)
# only 12 red cubes, 13 green cubes, and 14 blue cubes
# get valid game IDs, sum the IDS
lines = File
.readlines("input.txt")
.map{|line| line.strip }
.map{|line| line.split(/; |;/) }
.map {|lines|
line0 = lines.shift
num, round = line0[5..-1].split(": ")
[num.to_i, lines.unshift(round)]
@andrewzah
andrewzah / file.md
Last active September 15, 2021 20:39
dhcp lease debugging

signal chain

WAN -> Router -> Microtik Switch -> 8-port dumb switch -> not-working-machine

debugging

# dhclient -4 -v enp0s25

DHCPDISCOVER on 192.168.1.82 from 192.168.1.1
DHCPREQUEST for 192.168.1.82 on enp0s25 to 255.255.255.255 port 67
DHCPNAK from 192.168.1.1
@andrewzah
andrewzah / backup.sh
Created August 5, 2021 18:18
minecraft world backup script example
#!/bin/bash
set -ex
# back up the world, skipping if too many people are online
# triggered by user crontab
cd "$(dirname "$0")"
# where to store backups
@andrewzah
andrewzah / gist:ed008321799651ded9c2cac32b511697
Created April 2, 2021 17:15
metaflac --list (song downloaded from bandcamp)
METADATA block #0
type: 0 (STREAMINFO)
is last: false
length: 34
minimum blocksize: 4096 samples
maximum blocksize: 4096 samples
minimum framesize: 14 bytes
maximum framesize: 10872 bytes
sample_rate: 44100 Hz
channels: 2
MDMP�� D�_d�H7�4x����8X�gG��gGn8gG2�gGk�gG�P1 gG2
gG(�~
��*P���0�0��*�����@=@>@?@�P������R��xD@�P���R����O��yx�A`uz`S��hT��_9���P��yaS�����������m��Pp��@s�� v���x���{�����������@�����`������1X`XPX@X��X��X��X�X@� X��X0�"X �"X`�"X��"XP"X� X`#X`�X�X`�#X��#X��#X�X��X0�X�X@X@XP
X�XpX��XP�X��Xp�X�_X�bXeX�gX0jX�.X`1X�3X�6X9X�;X0>X�@X��X@�X��X`�X��X��XX�X0X�X0$#X�&#Xp)#X�X��X�X��X��X��X�X��#X`�#Xp�#X@�#X��#X�#X �#X0�#X��#X��#X��#X��#X/home/andrew/.local/share/Steam/ubuntu12_32/steamX0OX RX�UX�RX��X@|X0^X X�X06X��5XX��JX�0X ���\����z��P&X�S��\��@���D2XT���y�0X@�������