Skip to content

Instantly share code, notes, and snippets.

@jelc53
jelc53 / extract.sh
Created May 11, 2026 13:45
extract any archive by extension — figures out the right tool
#!/bin/bash
# Extract any archive by extension — figures out the right tool.
# Example: extract project.tar.gz
# extract release.zip
# extract bundle.7z
set -euo pipefail
if [ $# -ne 1 ]; then
echo "usage: extract <archive>" >&2
exit 1
@jelc53
jelc53 / killport.sh
Last active May 11, 2026 13:46
kill whatever process is listening on a tcp port
#!/bin/bash
# Kill whatever process is listening on a TCP port.
# Example: killport 3000
set -euo pipefail
if [ $# -ne 1 ]; then
echo "usage: killport <port>" >&2
exit 1
fi
@jelc53
jelc53 / open_text_files_with_helix.sh
Created May 11, 2026 09:53
lightweight wrapper bash script for yazi's file open command
#!/bin/bash
if [ -z "$1" ]; then
exit 1
fi
FILE_PATH="$1"
EXTENSION="${FILE_PATH##*.}"
@jelc53
jelc53 / detect_polinrider.sh
Created May 6, 2026 09:12
polinrider malware detector script that scans config files for known payload signatures
#!/usr/bin/env bash
# =============================================================================
# PolinRider Malware Detector — macOS Dev Laptop Edition
# Based on threat intelligence from: https://github.com/OpenSourceMalware/PolinRider
#
# DPRK / Lazarus "PolinRider" campaign — supply-chain attack via compromised
# npm packages / VS Code extensions that inject obfuscated JS payloads into
# common JS config files, then silently amend and force-push commits to GitHub.
#
# What this script checks:
@jelc53
jelc53 / detect_polinrider_process_ioc.sh
Created May 6, 2026 09:11
polinrider runtime ioc scanner (process + network only)
#!/usr/bin/env bash
#
# PolinRider Runtime IOC Scanner (process + network only)
# Extracted from detect_polinrider.sh — process rules kept in sync with scan_processes there.
#
# Usage:
# chmod +x detect_polinrider_process_ioc.sh
# ./detect_polinrider_process_ioc.sh
# ./detect_polinrider_process_ioc.sh --verbose
#
@jelc53
jelc53 / randomly_sample_iterable.ts
Created April 22, 2026 16:56
typescript code snippet for randomly filtering 10% of an iterable object
// TEMPORARY: Sample 10% of combos for testing — remove after validation
const sampledCombos = combos.filter(
() => Math.random() < 0.1
)
this.logger.info('Sampled combos for testing', {
totalCombos: combos.length,
sampledCombos: sampledCombos.length,
})
@jelc53
jelc53 / power_set_recursion.py
Created February 25, 2026 10:49
fun recursion example to generate all combination sets of a list
def power_set(my_list):
if len(my_list) == 0:
return [[]]
power_set_without_first = power_set(my_list[1:])
with_first = [ [my_list[0]] + rest for rest in power_set_without_first ]
return with_first + power_set_without_first
@jelc53
jelc53 / squash_and_rebase.txt
Last active February 25, 2026 10:50
step-by-step procedure for how to cleanly squash and rebase
Here's how to squash and cleanly rebase against upstream branch:
# 1. Soft reset to the merge-base (keeps your changes staged)
git reset --soft $(git merge-base main HEAD)
# 2. Commit everything as one squashed commit
git commit -m "Your squashed commit message"
# 3. Rebase onto current main
git rebase main # resolve merge conflicts once
@jelc53
jelc53 / conflict.txt
Last active January 29, 2026 08:46
helpful git commands for merge conflict resolution
# List conflicted files
git status --short | grep "^UU\|^AA\|^DD"
# Compare full versions (not just conflict markers)
git show HEAD:<file>
git show MERGE_HEAD:<file>
git diff HEAD MERGE_HEAD -- <file>
# Understand history
git log --oneline -20 -- <file>
@jelc53
jelc53 / settings.json
Created October 21, 2025 15:14
vscode joho settings
{
"workbench.startupEditor": "newUntitledFile",
"window.zoomLevel": 1,
"git.enableSmartCommit": true,
"git.autofetch": true,
"extensions.ignoreRecommendations": false,
"extensions.recommendations": [
"akamud.vscode-theme-onelight",
"aliariff.vscode-erb-beautify",
"andrewcourtice.theme-aurora",