Skip to content

Instantly share code, notes, and snippets.

@apeckham
apeckham / r.sh
Created May 5, 2024 06:21
100 random size images
for i in {1..100}; do
curl -L -o $i.jpg $(ruby -e 'puts "https://picsum.photos/" + (rand(1..100) * 10).to_s + "/" + (rand(1..100) * 10).to_s')
done
@apeckham
apeckham / .clj
Last active February 19, 2025 08:17
find free port in clojure
(defn get-free-port []
(with-open [socket (ServerSocket. 0)]
(.getLocalPort socket)))
@apeckham
apeckham / gist:2917943
Created June 12, 2012 14:43
block all contacts in Adium
tell application "Adium"
repeat with c in every contact
set blocked of c to true
end repeat
end tell
@apeckham
apeckham / appsmith.css
Last active November 28, 2024 02:41
custom appsmith component for wavesurfer audio player
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700&display=swap');
/* Waveform container styling */
#root {
background-color: #f9f9f9;
}
body {
font-family: 'Montserrat', sans-serif;
}
@apeckham
apeckham / gitlab-runner-priority.yaml
Last active September 21, 2024 19:56
gitlab runner on GKE autopilot
# Created new Autopilot cluster
# https://docs.gitlab.com/runner/install/kubernetes.html
# Create a runner at https://gitlab.com/groups/GROUP/-/runners
wget https://github.com/derailed/k9s/releases/download/v0.28.2/k9s_Linux_amd64.tar.gz
tar xvfz k9s*gz
gcloud container clusters get-credentials CLUSTER --region REGION --project PROJECT
helm repo add gitlab https://charts.gitlab.io
helm repo update gitlab
@apeckham
apeckham / gist:8e91d4bc66c32d6730db
Created August 4, 2015 19:18
aria2 on amazon linux
# download from http://sourceforge.net/projects/aria2/files/stable/aria2-1.19.0
sudo yum install gcc-g++ openssl-devel -y
tar xvfj aria2...tar.bz2
./configure
make -j$(nproc)
sudo make install
@apeckham
apeckham / reverse.sh
Created August 10, 2024 23:29
ffmpeg reverse video in memory-friendly chunks
#!/bin/bash
set -ex
# Input file name
input_file="input.mp4"
# Output file name
output_file="output.mp4"
# Duration of each segment in seconds (5 minutes)
@apeckham
apeckham / sum.sh
Created July 27, 2024 22:40
sum of PDF page count on mac
find . -maxdepth 1 -name "*.pdf" -exec mdls -name kMDItemNumberOfPages {} \; | awk '/kMDItemNumberOfPages/ {sum += $3} END {print sum}'
@apeckham
apeckham / extract.py
Created July 18, 2024 06:44
extract contents of a HAR file to disk, and request the URL if the content is not in the HAR
import json
import base64
import os
import sys
from urllib.parse import urlparse
import requests
def fetch_url(url):
try:
response = requests.get(url, timeout=10)
@apeckham
apeckham / claude.js
Created July 11, 2024 05:20
claude delete all conversations
async function deleteAllConversations() {
const organizationId = 'XXXXXXX';
const conversations = await fetch(`https://claude.ai/api/organizations/${organizationId}/chat_conversations`)
.then(response => response.json());
console.log(`Found ${conversations.length} conversations to delete.`);
for (const conversation of conversations) {
const deleteUrl = `https://claude.ai/api/organizations/${organizationId}/chat_conversations/${conversation.uuid}`;