Skip to content

Instantly share code, notes, and snippets.

View javelin's full-sized avatar

Mark Documento javelin

View GitHub Profile
@javelin
javelin / clean_by_ext.py
Last active December 16, 2025 06:06
Recursively delete files in a folder based on file extension.
#!/usr/bin/env python3
import sys
import os
from pathlib import Path
# Hardcoded list of extensions to delete (lowercase, without dots)
EXTENSIONS_TO_DELETE = [
# Images
"png", "jpg", "jpeg", "gif", "bmp", "webp", "tiff", "tif", "svg",
@javelin
javelin / spabs.md
Created June 22, 2025 22:20 — forked from eevee/spabs.md
tabs to spaces
@javelin
javelin / endian.h
Created June 8, 2023 00:44 — forked from yinyin/endian.h
BSD/Linux-like <endian.h> for MacOS X
#ifndef __FINK_ENDIANDEV_PKG_ENDIAN_H__
#define __FINK_ENDIANDEV_PKG_ENDIAN_H__ 1
/** compatibility header for endian.h
* This is a simple compatibility shim to convert
* BSD/Linux endian macros to the Mac OS X equivalents.
* It is public domain.
* */
#ifndef __APPLE__
@javelin
javelin / ffmpeg.md
Last active February 7, 2026 01:02
FFmpeg Cheat Sheet

FFmpeg Cheat Sheet

Adding silence to audio

Add silence to end adelay filter

ffmpeg -i input.wav -af "adelay=1s:all=true" output.m4a

Add silence to end using apad filter

ffmpeg -i input.wav -af "apad=pad_dur=1" output.m4a

Change aspect ratio

@javelin
javelin / udp_limiter.sh
Created June 4, 2022 08:22 — forked from arthurbeggs/udp_limiter.sh
Limit UDP bandwidth
#!/bin/bash
################################################################################
### UDP Upload Bandwidth Throttler ###
################################################################################
# #
# Based upon http://www.mzpeter.co.uk/limit-bandwidth-udp.html and #
# https://www.cyberciti.biz/faq/linux-traffic-shaping-using-tc-to-control-http\ #
# -traffic/ #
# #
@javelin
javelin / public_ip.sh
Created July 26, 2018 04:02
Get public IP from command line.
dig +short myip.opendns.com @resolver1.opendns.com
@javelin
javelin / borderAll.js
Last active July 19, 2018 02:47
Create a colored border around all elements of the same tag.
// For debugging HTML and CSS
function borderAll(tag, color) {
Array.prototype.slice.call(
document.getElementsByTagName(tag)).forEach((el) => {
el.style.border = '1px solid ' + (color || '#ff0000');
});
}
@javelin
javelin / launch_dev.sh
Created July 3, 2018 02:31
Tab-naming in Mac OS X terminal
#!/bin/bash
# File: ~/launch_dev.sh
# From http://dan.doezema.com/2013/04/programmatically-create-title-tabs-within-the-mac-os-x-terminal-app/
function new_tab() {
TAB_NAME=$1
COMMAND=$2
osascript \
-e "tell application \"Terminal\"" \
mysql -uroot -p -BNe "show global variables like 'socket'"
@javelin
javelin / root-ro
Created November 7, 2017 01:39 — forked from kidapu/root-ro
Read-only Root-FS with overlayfs for Raspian
#!/bin/sh
#
# Read-only Root-FS for Raspian
#
# Modified 2016 by Stefan Bonfert to make it compatible with Raspbian
# Jessie (vanilla).
#
# Modified 2015 by Pascal Rosin to work on raspian-ua-netinst with
# overlayfs integrated in Linux Kernel >= 3.18.
#