Skip to content

Instantly share code, notes, and snippets.

View nicoandmee's full-sized avatar
🏠
Working from home

Nico Kokonas nicoandmee

🏠
Working from home
View GitHub Profile
use std/dirs
def "path shorten" [--last] {
str replace $env.HOME "~" | if $last {
path split | last
} else { $in }
}
def --env "dirs reset-current" [] {
cd ($env.DIRS_LIST | get $env.DIRS_POSITION)
@nicholaswmin
nicholaswmin / zsh-guide.md
Last active July 25, 2025 04:57
user-centric zsh scripts

zsh style guide

guidelines for concise [zsh][zsh-wiki] scripts

authors: [nicholaswmin][authorgh] - The [MIT][mit-lcns] License.

The keywords must/must not are to be interpreted as described in [RFC-2119][rfc-2119].
This formality is kept to a minimum because this document is meant to be LLM-parseable;
in other cases, your own unique context dictates their applicability.

@prescience-data
prescience-data / filesystem.ts
Last active June 9, 2025 06:06
Save and restore session data using Playwright
import { exec } from "node:child_process"
import { createReadStream, createWriteStream, existsSync, readFileSync } from "node:fs"
import { mkdir } from "node:fs/promises"
import { basename, dirname, join } from "node:path"
import { pipeline } from "node:stream/promises"
import { promisify } from "node:util"
import { createGzip } from "node:zlib"
import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3"
@AzureFlow
AzureFlow / rotateString.js
Created March 24, 2025 03:58
Akamai BMP native (`libakamaibmp.so`) string concealment
const RotateDirection = Object.freeze({
Left: -1,
Right: 1,
});
// Init the ASCII character mapping table (equivalent to the large local_* arrays)
// /** @type {string[]} */
// const charMap = [];
// for(let i = 32; i < 127; i++) {
// // Skip " ' \ \x7F
@tomnomnom
tomnomnom / bash-timestamp.sh
Created December 18, 2024 11:22
Print a grey timestamp before running bash commands
PROMPT_COMMAND='PS1_RUN_PREEXEC=1'
preexec() {
if [ -z "$PS1_RUN_PREEXEC" ]; then
return
fi
unset PS1_RUN_PREEXEC
echo $'\e[38;5;241m'"[$(date +'%Y-%m-%dT%H:%M:%S%z')]"$'\e[0m'
}
trap 'preexec' DEBUG
@transitive-bullshit
transitive-bullshit / hash-object.ts
Created November 7, 2024 19:14
Get the hash of an object
import decircular from 'decircular'
import isObject from 'is-obj'
import sortKeys from 'sort-keys'
import { type LiteralUnion } from 'type-fest'
export type Encoding = 'hex' | 'base64' | 'buffer'
export type Algorithm = LiteralUnion<'sha1' | 'sha256' | 'sha512', string>
export type Options = {
/**
@rmtbb
rmtbb / ChatGPT Canvas HTML Renderer from Clipboard.url
Last active July 5, 2025 17:49
Bookmarklet that lets you render a full HTML page with any included css and javascript that is currently copied to your clipboard. Also works for SVG code. Useful with ChatGPT Canvas
javascript:(function(){try{navigator.clipboard.readText().then(function(t){if(t){var e=window.open("","_blank","width=800,height=600");e.document.open(),e.document.write(t),e.document.close()}else alert("Clipboard is empty. Please copy some text to the clipboard first.")}).catch(function(t){console.error("Failed to read clipboard contents: ",t),alert("An error occurred while trying to access the clipboard. Please ensure your browser allows clipboard access.")})}catch(t){console.error("An error occurred:",t),alert("An error occurred while trying to open the new window with the clipboard content.")}})();//bookmarklet_title: HTML Preview from Clipboard
@mukesh-610
mukesh-610 / favicon_mapper.py
Created September 9, 2024 09:01
Grabs the favicon of a target site and searches it against a database of known favicons to fingerprint your target web application.
import hashlib
import requests
import yaml
import argparse
YAML_FILE = 'favicons-database.yml'
def fetch_favicon(url):
try:
response = requests.get(f'{url}/favicon.ico', timeout=10, verify=False)
@armenr
armenr / clipsync.sh
Last active July 18, 2025 09:39
ClipSync (2-way clipboard sync between Wayland and X11 + cliphy support)
#!/usr/bin/env sh
#
# Two-way clipboard syncronization between Wayland and X11, with cliphy support!
# !! Recommended use: Drop this file off @ /usr/local/bin/clipsync && make it executable
# Requires: wl-clipboard, xclip, clipnotify.
# Modified from: https://github.com/hyprwm/Hyprland/issues/6132#issuecomment-2127153823
#
# Usage:
# clipsync watch [with-notifications|without-notifications] - run in background.
# clipsync stop - kill all background processes.
@kverb
kverb / wsj_ladder.js
Created August 30, 2024 16:56
WSJ Ladder on cloudflare workers
// JS Snippet for a cloudflare worker to get the "Shareable" URL for a wsj.com article by URL.
// Requires a valid, authenticated wsj.com cookie jar.
// Uses a cloudflare workers KV namespace bound to `TestKV` to store/fetch the cookies.
// getting these cookies is a pain. This was extracted using the chrome dev tools > copy request as Fetch and manually filtering out just the cookie header
const default_cookies = 'datadome=7S65yfEc866mp9GpkZUQXtvYKJHblCG5VlkmmCEzHErmZn4Cxj1DizrKaq6u_WW~SL3xkFUyv2sas2PJxIMAdJxPJ3skZr009v4kbL4sHsdYAnJHZhN0wtr8F8WRDz1l; djcs_route=7055a21f-09ec-48b1-b187-06518dfd9f6f; ca_rt=3IX-ARt2INJ47c8pbe87kw.SvzY1D2JoWw2n_c_Y3_wN78ns1LcSsITZEjFkMVz9K-dt9Nv7zaM-KWrg7GZRSWwHURy6sMrpRN6x68I6P9mtncYsvXMhVCnFdZnEnVxlj8; _pcid=%7B%22browserId%22%3A%22ltofwg00gm2jgtk9%22%7D; cX_P=ltofwg00gm2jgtk9; _pubcid=ddebe880-2003-4d12-8da8-2511b02cc014; _sp_su=false; TR=V2-a80a4882c66bd273e8409f9b32bf2dc04f6968616ebc9adf8c862073eeb1efea; ab_uuid=2eaa406a-31e0-49a8-bad2-bb149907d4d2; _ncg_domain_id_=00f9e1d