Skip to content

Instantly share code, notes, and snippets.

@HananoshikaYomaru
HananoshikaYomaru / fix.css
Last active October 16, 2024 13:08
life calendar in obsidian using dataview js
/* wide */
.wide .markdown-preview-sizer {
max-width: unset !important;
}
.life-calendar p a.internal-link {
display: inline-block;
}
@joelonsql
joelonsql / flashback_logging.md
Created August 18, 2023 07:14
Flashback Logging

Flashback Logging

NOTE: Post-writing, I discovered a similar concept named Ring Buffer Logging. What sets Flashback Logging apart is its approach to handling the buffer. When a log event matches the standard log level threshold, such as 'INFO', the buffer is cleared. This behavior is based on the rationale that such a log event indicates the system's return to normal operations, eliminating the need to keep previously buffered entries.

Introduction

Flashback Logging is a design pattern in the logging and debugging domain. Its primary goal is to reduce the time spent on debugging by making verbose logs readily available during error occurrences without the storage overhead of always keeping verbose logs.

@kconner
kconner / macOS Internals.md
Last active November 13, 2024 07:51
macOS Internals

macOS Internals

Understand your Mac and iPhone more deeply by tracing the evolution of Mac OS X from prelease to Swift. John Siracusa delivers the details.

Starting Points

How to use this gist

You've got two main options:

@mmoskal
mmoskal / population.md
Created April 8, 2023 17:17
time ever lived in human history
year population (M) time pop.avg (M) years lived (B) total years lived (B) % years lived
-190000 0
-50000 2 140000 1 140 140 6.45
-8000 5 42000 3.5 147 287 13.21
-7000 7 1000 6 6 293 13.49
-6000 14 1000 10.5 11 304 14
-5000 27 1000 20.5 21 325 14.96
-4000 50 1000 38.5 39 364 16.76
-3000 100 1000 75 75 439 20.21
@mmoskal
mmoskal / population.mjs
Created April 8, 2023 17:16
compute time ever lived in human history
import { writeFileSync } from "node:fs"
// data from https://en.wikipedia.org/wiki/Estimates_of_historical_world_population PRB column
// and https://www.prb.org/articles/how-many-people-have-ever-lived-on-earth
const data = `
-190000 0
-50000 2M
-8000 5M
0 300M
1200 450M
@gnat
gnat / postgres_portable_no_install.md
Last active July 22, 2024 09:47
Postgres Standalone

🐘 Postgres Standalone

Why?

  • Localize your database into one single folder of your choosing.
  • No sudo / root requirement.
  • Run multiple Postgres at the same time on the same machine- Full bare metal performance.
  • Postgres is a great starter before moving to "slow single machine but horizontal scale": CockroachDB, ScyllaDB, etc.

Compile

@rbitr
rbitr / random_notes.md
Last active November 10, 2023 16:34
Confusion about using $RANDOM to generate random numbers

Random numbers in bash et al

There is a variable $RANDOM than you can read in bash or zsh to get a random number beteen 0 and 32767. Here in zsh on my (old) mac:

% echo $RANDOM
13757
% echo $RANDOM
16896
@ghostffcode
ghostffcode / BatchResolver.sol
Last active May 18, 2023 20:21
Batch Resolve ENS names to addresses
//SPDX-License-Identifier: MIT
pragma solidity >=0.8.0 <0.9.0;
abstract contract Registry {
function resolver(bytes32 node) external view virtual returns (address);
}
abstract contract Resolver {
function addr(bytes32 node) external view virtual returns (address);
}
@aileftech
aileftech / hex-colors.txt
Created October 1, 2022 18:10
A Bash one-liner to produce a list of HEX color codes that read like (supposedly) valid English words
$ grep -P "^[ABCDEFabcdefOoIi]{6,6}$" /usr/share/dict/words | tr 'OoIi' '0011' | tr '[:lower:]' '[:upper:]' | awk '{print "#" $0}'
#ACAD1A
#B0BB1E
#DEBB1E
#AB1DED
#ACAC1A
#ACCEDE
#AC1D1C
#BAB1ED
#BA0BAB