Skip to content

Instantly share code, notes, and snippets.

@Prototyped
Prototyped / 0-macos-sequoia-de-nerf.md
Last active September 27, 2025 17:57
macOS de-nerf (Sequoia anyway)

macOS de-nerf

This writeup targets macOS Sequoia and is for people like me who got used to other operating systems but have to tolerate macOS's brain damage for work.

Don't sleep on lid close

System Settings → Battery → Options... → Prevent automatic sleeping on power adapter when the display is off (on)

Install and use Fermata to keep laptop awake on battery without an external monitor attached.

@Prototyped
Prototyped / .bashrc
Last active January 28, 2024 19:49
Ultimate bash prompt
__normesc="$(tput sgr0)"
__boldesc="$(tput bold)"
__unboldesc='\e[22m'
__dimesc="$(tput dim)"
__italicesc="$(tput sitm)"
__unitalicesc="$(tput ritm)"
__underlineesc="$(tput smul)"
__ununderlineesc="$(tput rmul)"
__blinkesc="$(tput blink)"
__unblinkesc='\e[25m'
@Prototyped
Prototyped / bad-interpreter.txt
Created October 20, 2023 15:55
Bad interpreter
# amitg @ athena in ~ [16:53:46]
% cat > bad-interpreter
#!/no/yuo
echo HELLO
# amitg @ athena in ~ [16:54:08]
% chmod +x bad-interpreter
# amitg @ athena in ~ [16:54:16]
@Prototyped
Prototyped / .profile
Created October 15, 2023 16:31
.profile bridge with .conf/environment.d/*.conf
for conf in "$HOME/.config/environment.d"/*.conf
do
if [ -r "$conf" ]
then
substituted="/tmp/${LOGNAME}.envs.systemd.blows.$$.txt"
envsubst < "$conf" > "$substituted"
while read -r line
do
new_cleaned_up="${line%#*}"
cleaned_up=""
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault cat_l2 invpcid_single cdp_l2 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves split_lock_detect avx_vnni avx512_bf16 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid movdir
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault cat_l2 invpcid_single cdp_l2 ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb intel_pt avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves split_lock_detect avx_vnni avx512_bf16 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi avx512vbmi umip pku ospke waitpkg avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg tme avx512_vpopcntdq rdpid movdir
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[]) {
pid_t pid;
if (argc > 1) {
@Prototyped
Prototyped / backup.sh
Created March 14, 2022 13:39
Borg backup
#!/bin/bash
set -euo pipefail
PATH=${PATH}:/sbin:/usr/sbin
[ -x /etc/init.d/lvm2-lvmetad ] && /etc/init.d/lvm2-lvmetad restart
[ -x /etc/init.d/lvm2-lvmpolld ] && /etc/init.d/lvm2-lvmpolld restart
$ time ./stream_haswell.bin
-------------------------------------------------------------
STREAM version $Revision: 5.10 $
-------------------------------------------------------------
This system uses 8 bytes per array element.
-------------------------------------------------------------
Array size = 269000000 (elements), Offset = 0 (elements)
Memory per array = 2052.3 MiB (= 2.0 GiB).
Total memory required = 6156.9 MiB (= 6.0 GiB).
Each kernel will be executed 100 times.
$ time docker run --rm gurdasani.com/stream/stream /usr/local/bin/stream_avx2.bin
-------------------------------------------------------------
STREAM version $Revision: 5.10 $
-------------------------------------------------------------
This system uses 8 bytes per array element.
-------------------------------------------------------------
Array size = 269000000 (elements), Offset = 0 (elements)
Memory per array = 2052.3 MiB (= 2.0 GiB).
Total memory required = 6156.9 MiB (= 6.0 GiB).
Each kernel will be executed 100 times.