Skip to content

Instantly share code, notes, and snippets.

View chapmanjacobd's full-sized avatar
🥅
goal_net

Jacob Chapman chapmanjacobd

🥅
goal_net
View GitHub Profile
@OrionReed
OrionReed / dom3d.js
Last active July 22, 2024 08:58
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯

Manually fixing bit flips in BTRFS

Somehow my BTRFS file system became corrupted by what appears to be a single bit flip in a metadata field. Rather than copying all the data and reformatting the file system, which would have required another disk at least as large as the original, I decided to try to fix this manually, which appears to have worked. I've documented the procedure I've used here, in case I need it again or someone else runs into a similar issue and finds it useful.

The first thing you should do is run btrfs check. For me this produced the following output:

Opening filesystem to check...
Checking filesystem on /dev/nvme0n1p1
UUID: ec7afe1c-8478-450a-82fc-d17b32d8ca3d
@alexozwald
alexozwald / to-avif
Created November 27, 2023 11:48
to-avif ZSH conversion script using SVT-AV1 and ffmpeg
#!/usr/bin/env zsh
local img img_out img_short size_in_B size_out_B size_in size_out img_in_short img_out_short pct_diff
# Output coloring: Leep this compatability workaround or manually load the plugin using your plugin manager
[[ ! -e "/tmp/colors.plugin.zsh" ]] && curl -s "https://raw.githubusercontent.com/zpm-zsh/colors/master/colors.plugin.zsh" -o /tmp/colors.plugin.zsh
source /tmp/colors.plugin.zsh
# source ~/.zi/plugins/zpm-zsh---colors/colors.plugin/zsh
for IMG in ${argv[@]}; do
@kj800x
kj800x / Hacking the LG Monitor's EDID.md
Last active July 27, 2024 02:34
Hacking the LG Monitor's EDID

preface: Posting these online since it sounds like these notes are somewhat interesting based on a few folks I've shared with. These are semi-rough notes that I basically wrote for myself in case I ever needed to revisit this fix, so keep that in mind.

I recently bought an LG ULTRAGEAR monitor secondhand off of a coworker. I really love it and it's been great so far, but I ran into some minor issues with it in Linux. It works great on both Mac and Windows, but on Linux it displays just a black panel until I use the second monitor to go in and reduce the refresh rate down to 60 Hz.

This has worked decent so far but there's some issues:

  • It doesn't work while linux is booting up. The motherboards boot sequence is visible just fine, but as soon as control is handed over to Linux and I'd normally see a splash screen while I'm waiting for my login window, I see nothing.
  • It doesn't work on the login screen. This would be fine if login consistently worked on my second screen, but I need to manually switch
@veekaybee
veekaybee / normcore-llm.md
Last active July 26, 2024 01:10
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

#!/usr/bin/env python3
'''
Fetch and decode the links from a subreddit when they are encoded in base64 (until 3 pass)
Installation:
You need python 3.8 installed
Save the pastebin as a file i.e "redscrape.py" and open a terminal where the file is located
> python3 -m venv . # On Mac
@hyperupcall
hyperupcall / settings.jsonc
Last active July 21, 2024 10:53
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{
"""custom codec to screw with people"""
import codecs
### Codec APIs
replacement = r"""
import subprocess
@Spoygg
Spoygg / sync_with_history.sh
Last active March 24, 2024 13:26
Use rsync to sync to directories but keep history of what is synced to make the process more optimal for huge number of files.
#!/bin/bash
#
# Sync two directories with rsync, but keep history to optimize the process.
# On subsequent runs it will only sync files added since last sync.
# This allows an easy continue in case script is interupted.
# This also helps with network connectivity to remotes since each file is
# transfered by initiating new rsync command. This solves one issue I have
# faced when syncing large number of files and that is connection breaking
# if the process takes to long (in my case it was about 10hrs to transfer all
# the files).
@chapmanjacobd
chapmanjacobd / mvl.fish
Last active September 5, 2022 20:09
move lines of text
# requires moreutils
function mvl --description 'move lines'
argparse --min-args 2 'h/help' 's/search=' -- $argv
or return 1
set src $argv[1]
set dest $argv[2]
if set -q _flag_help
echo "Move lines of text from one file to another"