Skip to content

Instantly share code, notes, and snippets.

View johncf's full-sized avatar

John Charankattu johncf

View GitHub Profile
@johncf
johncf / windows-dev-setup.md
Last active October 13, 2024 15:15
Setting up Windows for development (Scoop, MSys2, Alacritty, BuildTools etc.)

Scoop

To install Scoop (official docs), execute in Powershell:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
irm get.scoop.sh -outfile 'install-scoop.ps1'
get-help .\install-scoop.ps1
.\install-scoop.ps1
@johncf
johncf / avifenc-hdr.md
Last active October 9, 2024 12:39
AVIF with HDR and CICP (Coding-Independent Code Points) settings

To convert an HDR PNG that's exported with HLG transfer function in Rec. 2020 color space, do:

avifenc -s 4 -j 4 --min 1 --max 56 -a end-usage=q -a cq-level=18 -a tune=ssim \
    -a color:enable-chroma-deltaq=1 -a color:enable-qm=1 -d 12 --cicp 9/18/9 IMG_0186.png IMG_0186.avif

For HDR with PQ transfer function in Rec. 2020 color space, do:

@johncf
johncf / interview-timer.py
Created August 4, 2024 21:38
A simple timer with audio alerts to run during an interview
#!/bin/env python3
import time
from datetime import datetime as dt
import numpy as np
import simpleaudio as sa
from scipy.signal import savgol_filter
from tqdm import tqdm
# based on https://www.reddit.com/r/AV1/comments/o7s8hk/
img=test.jpg
avifenc -s 4 -j 4 --min 1 --max 63 -y 420 \
-a end-usage=q -a cq-level=18 -a tune=ssim \
-a color:enable-chroma-deltaq=1 -a color:enable-qm=1 \
-a color:deltaq-mode=3 "$img" "avif/${img%.???}.avif"
@johncf
johncf / 00-Install-Debian.md
Last active October 30, 2024 13:32
Debian installation in Asus Zenbook S13
@johncf
johncf / find.sh
Last active April 20, 2024 20:32 — forked from gr1ev0us/find.sh
Cheatsheet for find linux
# Based on: https://alvinalexander.com/unix/edu/examples/find.shtml
# basic 'find file' commands
# --------------------------
find / -name foo.txt -type f -print # find regular files under / with name foo.txt
find / -name foo.txt -type f # -print is the default action, and may be omitted
find . -name foo.txt # search under the current dir, and all types
find . -name "foo*" -type d # wildcard name-matching, and only directories
find /opt /usr /var -name foo.scala -type f # search multiple dirs
find . -iname foo # case-insensitive: foo, Foo, FOo, FOO, etc.
@johncf
johncf / onnx-inspect.py
Created November 15, 2023 18:41
Inspect an ONNX model file for sanity
import sys
import traceback
import onnx
if len(sys.argv) != 2:
print(f"Usage: {sys.argv[0]} /path/to/model.onnx")
sys.exit(1)
model_path = sys.argv[1]
@johncf
johncf / imagenet-extract-val.py
Last active November 15, 2023 19:20
Extract validation set from IMAGENET into another zip file, with label-directories
import os.path
import gzip
import pickle
from zipfile import ZipFile
# from https://github.com/onnx/models/blob/8d50e3f/vision/classification/imagenet_val_maps.pklz
with gzip.open('imagenet_val_maps.pklz', 'rb') as f:
dirs, mappings = pickle.load(f)
src_dir = "ILSVRC/Data/CLS-LOC/val"
target_dir = "ILSVRC/val"
@johncf
johncf / backup.json
Last active May 18, 2024 11:28
Vimium configuration
{
"keyMappings": "map h scrollUp\nmap k scrollDown\nmap j scrollLeft\n\nmap H previousTab\nmap K nextTab\nmap J goBack\n\nunmap zH\nunmap zL",
"linkHintCharacters": "arstwfpzxcvgd",
"searchEngines": "w: https://www.wikipedia.org/w/index.php?title=Special:Search&search=%s Wikipedia\ng: https://www.google.com/search?q=%s Google\ny: https://www.youtube.com/results?search_query=%s Youtube\naz: https://www.amazon.in/s/?field-keywords=%s Amazon India\ngm: https://www.google.com/maps?q=%s Google Maps\nfk: https://www.flipkart.com/search?q=%s Flipkart",
"searchUrl": "https://duckduckgo.com/?q=",
"settingsVersion": "2.1.2",
"exclusionRules": [
{
"passKeys": "",
"pattern": "https?://mail.google.com/*"
P: Parts
C: Confusable
Ex: Example
Mn: Mnemonic
adv. -- adverb
n. -- noun
i-adj. -- I-adjective
na-adj. -- NA-adjective
prop. n. -- proper noun