Skip to content

Instantly share code, notes, and snippets.

View pierrenel's full-sized avatar
:shipit:

Pierre Nel pierrenel

:shipit:
View GitHub Profile
@jwbee
jwbee / jq.md
Last active March 25, 2025 12:56
Make Ubuntu packages 90% faster by rebuilding them

Make Ubuntu packages 90% faster by rebuilding them

TL;DR

You can take the same source code package that Ubuntu uses to build jq, compile it again, and realize 90% better performance.

Setting

I use jq for processing GeoJSON files and other open data offered in JSON format. Today I am working with a 500MB GeoJSON file that contains the Alameda County Assessor's parcel map. I want to run a query that prints the city for every parcel worth more than a threshold amount. The program is

@questionlp
questionlp / Installing FreeBSD on a Steam Deck.md
Last active January 20, 2025 20:05
Installing FreeBSD on a Steam Deck

Installing FreeBSD 14.2 on a Steam Deck

Update: A full write-up has been posted on my blog at: https://blog.linh.social/2025/01/11/installing-running-freebsd-on-steam-deck/. The post also includes some corrections and new learnings since creating this gist.

Installing onto the internal NVMe SSD

  1. Download and burn a FreeBSD 14.2 amd64 installer ISO from FreeBSD.org
  2. Burn the installer ISO on to a USB drive, or use a multi-boot tool like IODD or Ventoy
  3. Use a USB dock or hub (Anker PowerExpand or 543 6-in-1 USB hub is what I've been using) with USB power delivery pass-through to connect the following devices:
  4. USB-C power adapter
@adtac
adtac / README.md
Last active February 22, 2025 17:34
Using your Kindle as an e-ink monitor

3.5 fps, Paperwhite 3
@adtac_

step 1: jailbreak your Kindle

mobileread.com is your best resource here, follow the instructions from the LanguageBreak thread

I didn't really follow the LanguageBreak instructions because I didn't care about most of the features + I was curious to do it myself, but the LanguageBreak github repo was invaluable for debugging

@OrionReed
OrionReed / dom3d.js
Last active March 26, 2025 22:06
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; // ¯\\_(ツ)_/¯
@talkingmoose
talkingmoose / Sonoma-compatible Macs (regex)
Last active December 13, 2024 21:37
Regex looks for all Mac models compatible with macOS Sonoma. May not be up-to-date with newly released models.
https://support.apple.com/en-us/HT213772
Published Date: March 8, 2024
Verification: https://regex101.com/r/GCfKMt/11
1) Exact regex — Matches major model identifier numbers based on Apple's knowledge base article (more accurate):
^(Mac(1[345]|BookPro1[5-8]|BookAir([89]|10)|Pro7)|iMac(Pro1|(19|2[01]))|Macmini[89]),\d+$
2) Current or higher regex — Matches model identifiers based on Apple's knowledge base article and may match higher versions before this regex is updated (more future-proof).
@joshcawthorne
joshcawthorne / useWindowSize.js
Last active February 24, 2025 06:43
SSR-Compatible (NextJS, Gatsby etc) React hook for getting Window Size.
import { useState, useEffect } from "react";
function useWindowSize() {
const [windowSize, setWindowSize] = useState<{ width: number | undefined; height: number | undefined }>({
width: undefined,
height: undefined,
});
useEffect(() => {
function handleResize() {
@IanColdwater
IanColdwater / twittermute.txt
Last active March 18, 2025 17:59
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@bmatcuk
bmatcuk / create-usb.sh
Created May 30, 2019 04:38
Creating a Bootable Windows USB from ISO on a Mac
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
# This will output a bunch of info about all of the disk drives connected to
# your Mac. Each entry will have a header in the form "/dev/diskX", where X is
# some number starting at 0. Now, insert your USB drive and run the command
# again. You should see a new entry. Make note of the name (ie, /dev/diskX).
diskutil list
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active March 19, 2025 12:02
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;
}
@antoniocapelo
antoniocapelo / use-scroll-listener.js
Last active July 8, 2019 09:57
Custom React Hook for setting a passive scroll listener and get updated scrollY and scroll direction information
/**
* useScrollListener hook
* Usage: const { scrollY, scrollDirection } = useScrollListener();
*/
import { useState, useRef, useEffect } from 'react';
export function useScroll() {
const [scrollY, setScrollY] = useState(0);
const [progress, setProgress] = useState(0);