Skip to content

Instantly share code, notes, and snippets.

@apeckham
apeckham / gist:2db891e45d0649eda10748c9d22be4ca
Created August 30, 2024 17:50
custom appsmith component for wavesurfer audio player
import WaveSurfer from 'https://cdn.jsdelivr.net/npm/wavesurfer.js@7/dist/wavesurfer.esm.js';
appsmith.onReady(() => {
const wavesurfer = WaveSurfer.create({
container: '#root',
waveColor: '#4F4A85',
progressColor: '#383351',
url: '[url with cors setup]',
});
document.getElementById('startButton').addEventListener('click', () => {
@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}`;
@apeckham
apeckham / gist:e98a303a9de73b4cf037
Created June 11, 2015 17:44
find broken symlinks on mac os x
#http://unix.stackexchange.com/questions/34248/how-can-i-find-broken-symlinks
find . -type l ! -exec test -e {} \; -print
@apeckham
apeckham / ffmpeg.sh
Created June 3, 2024 04:51
slow all webm's to 69%
for i in *.webm; do [ ! -f "${i%.webm}.slow.mp4" ] && ffmpeg -i "$i" -vf "setpts=1/0.69*PTS" -af "atempo=0.69" -c:v libx264 -preset ultrafast -crf 23 -c:a aac -b:a 128k "${i%.webm}.slow.mp4"; done
@apeckham
apeckham / simba.clj
Created August 24, 2017 03:28
connect to bigquery with clojure.java.jdbc
(ns simba
(:require [clojure.java.jdbc :as j])
(:import (com.simba.googlebigquery.jdbc42 Driver)))
(def conn {:classname "com.simba.googlebigquery.jdbc42.Driver"
:subprotocol "bigquery"
:subname "//https://www.googleapis.com/bigquery/v2:443;ProjectId=MY-PROJECT-ID;OAuthServiceAcctEmail=USERNAME@PROJECT.iam.gserviceaccount.com;OAuthPvtKeyPath=PATH-TO-P12-FILE"})
(defn run-query [query] (j/query conn [query]))
@apeckham
apeckham / .sh
Created February 1, 2017 00:22
run minio under docker
docker run -e MINIO_ACCESS_KEY=minio -e MINIO_SECRET_KEY=miniostorage -p 9000:9000 minio/minio server /export
cat >>~/.aws/config
[profile minio-play]
region = us-east-1
s3 =
signature_version = s3v4
cat >>~/.aws/credentials
[minio-play]