Skip to content

Instantly share code, notes, and snippets.

View pathcl's full-sized avatar

pathcl

View GitHub Profile
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"os"
"path/filepath"
"strings"
@pathcl
pathcl / config.ghostty
Last active July 8, 2026 21:02
config.ghostty
theme = Nord
font-family = Menlo
font-size = 18
background = #2e3440
foreground = #d8dee9
keybind = super+t=new_tab
keybind = super+w=close_surface
@pathcl
pathcl / make-me-an-ipod.py
Last active January 20, 2026 17:38
Download music from a spotify playlist
# Note: pip install spotipy yt-dlp
import spotipy
from spotipy.oauth2 import SpotifyClientCredentials
import yt_dlp
# Obtain these from https://developer.spotify.com/dashboard
SPOTIFY_CLIENT_ID = "xxxx"
SPOTIFY_CLIENT_SECRET = "xx"
@pathcl
pathcl / README.md
Created February 3, 2025 20:53 — forked from alexcpn/README.md
Prophet for Anomaly detection
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDdVssE5hBqzqHfRg6JFRWUAehdMq/jpY9/6gMYhzeu0LhdF3o2vbR5JBTkiSSM0i7dJRH2MHwIRzCThMb16lSCQwUb+JZNPccvq2KifHOkf9RP3NeRf/YO8ExcgCUYrVi79mgHus9YT4DyIhWL7Txt1geqnhLeqgfFtKpJh8bwaXHNfDISEYPnhWG4MUZDPHlALGfhdhoJbFZ4ct6ji1qqX8Msp2lbzcDSe5FESJtMPN5RoBwlfAW0dcG79H3axwFHisWVjfw9rJnMvwLi3WUbP9Wxb6G8z8tcqQWydvOKBvZk3rUSUvCOT/AcJIxVyqE3ZMYxAxI7Y5EkMKG/XYgh1c+2FDzWWE+KfeR6OTpm+TVCKodo9LCf26BTNnjZ/YsNuDDND9Vt6KiedZIu2xwmCkd+ovl6C+DfAViWo2RCIJKoWOORn5+CCao1KsPggZSQye7iexX/jrpmdnZyhq317de49liwZsPPfJsZuvqgBYzr6Wn3zkw3EpWtLBzMPP0= pathcl@espresso
@pathcl
pathcl / gitlab-reenable-signin.sh
Created January 3, 2024 18:37 — forked from 0xKayvan/gitlab-reenable-signin.sh
enable gitlab sign-in after accidentally disable it in admin
sudo gitlab-rails console
ApplicationSetting.last.update_attributes(signin_enabled: true)
exit
sudo gitlab-ctl restart
@pathcl
pathcl / docker-exec-ecs.sh
Created June 2, 2022 17:30 — forked from ipmb/docker-exec-ecs.sh
docker exec on AWS ECS with SSM
#!/bin/bash
# USAGE: CLUSTER=mycluster SERVICE=myservice ./docker-exec-ecs.sh
set -euf -o pipefail
TASK_ARN=$(aws ecs list-tasks --cluster=$CLUSTER --service=$SERVICE \
| jq -r .taskArns[0])
if [ "$TASK_ARN" = "null" ]; then
echo "Could not find any running tasks for $SERVICE on cluster:$CLUSTER."
exit 1
fi
@pathcl
pathcl / firewall.py
Last active November 7, 2021 18:08
Basic firewall on nftables && share internet
#!/usr/bin/env python3
import argparse
import nftables
import json
from string import Template
def main(wan, lan):
'''
USE AT YOUR OWN RISK :)
@pathcl
pathcl / firewall.sh
Last active November 7, 2021 18:10
Basic firewall on nftables && share internet
#!/bin/bash
# executable for nftables
nft="/usr/sbin/nft"
# wan and lan ports
wan=$1
lan=$2
# check empty arguments
@pathcl
pathcl / latency.txt
Created June 23, 2021 09:06 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD