Skip to content

Instantly share code, notes, and snippets.

@rgcoe
rgcoe / movtogif.sh
Last active April 8, 2025 20:28
movtogif
movtogif () {
tempfile=.mov-to-gif-$(date +"%s").png
ffmpeg -v quiet -stats -y -i $1 -vf fps=5,palettegen $tempfile
ffmpeg -v quiet -stats -i $1 -i $tempfile -filter_complex "fps=12.5,scale=720:-1,paletteuse" "${1%.mov}.gif"
rm $tempfile
}
@rgcoe
rgcoe / compresspdf.sh
Last active April 8, 2025 20:28
compresspdf
# Args: in_file out_file (screen, ebook, printer)
compresspdf() {
gs -sDEVICE=pdfwrite \
-dDetectDuplicateImages=true \
-dConvertCMYKImagesToRGB=true \
-dCompressFonts=true \
-dNOPAUSE \
-dQUIET \
-dBATCH \
-dPDFSETTINGS=/${3:-"prepress"} \
@rgcoe
rgcoe / blums.py
Created February 15, 2021 15:49
Blum's test for independence
def blums(x, y=None, sig_lev=0.01):
"""
Performs Blum's test for independence.
Blum, J. R., et al. “Distribution Free Tests of Independence Based on the
Sample Distribution Function.” The Annals of Mathematical Statistics, vol.
32, no. 2, 1961, pp. 485–498. JSTOR, www.jstor.org/stable/2237758.
Parameters
----------