Skip to content

Instantly share code, notes, and snippets.

View gif_this.py
#!/bin/sh
import os
from pathlib import Path
import argparse
import subprocess
def _gif_this(source_file, output, start_time, end_time, duration, fps, scale):
"""
http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
@totetmatt
totetmatt / gist:de39f9cce1afc6e65c144b1fbcc28461
Created Aug 13, 2021
Tonight 21:00 UTC to your local date
View gist:de39f9cce1afc6e65c144b1fbcc28461
==| 2021-08-13 @ 10:00 |==
Pacific/Midway
Pacific/Niue
Pacific/Pago_Pago
Pacific/Samoa
US/Samoa
==| 2021-08-13 @ 11:00 |==
Pacific/Honolulu
Pacific/Johnston
Pacific/Rarotonga
View shader.glsl
#version 410 core
uniform float fGlobalTime; // in seconds
uniform vec2 v2Resolution; // viewport resolution (in pixels)
uniform float fFrameTime; // duration of the last frame, in seconds
uniform sampler1D texFFT; // towards 0.0 is bass / lower freq, towards 1.0 is higher / treble freq
uniform sampler1D texFFTSmoothed; // this one has longer falloff and less harsh transients
uniform sampler1D texFFTIntegrated; // this is continually increasing
uniform sampler2D texPreviousFrame; // screenshot of the previous frame
View generate_texture_from_image.sh
# Create a texture that concat profile
mogrify -resize 512x512! *.png ; montage -mode concatenate -tile x1 *.png ../tex1.jpg
View youtube_chapter.sh
#!/bin/sh
set -x
#Download media + metadata
youtube-dl --write-info-json -x --audio-format mp3 -o "tmp_out.%(ext)s" $1
# Maybe a way to get the file name from previous function
INFO="tmp_out.info.json"
AUDIO="tmp_out.mp3"
echo :: $INFO $AUDIO ::
@totetmatt
totetmatt / kata-starwars.sh
Last active Jun 20, 2020
kata-starwars.sh
View kata-starwars.sh
## Generation of files ##
cat > movies.txt <<EOL
A New Hope (1977)
The Empire Strikes Back (1980)
Return of the Jedi (1983)
The Phantom Menace (1999)
Attack of the Clones (2002)
Revenge of the Sith (2005)
The Force Awakens (2015)
@totetmatt
totetmatt / demo.shader
Created Feb 20, 2020
Kodelife shader program
View demo.shader
#version 150
in VertexData
{
vec4 v_position;
vec3 v_normal;
vec2 v_texcoord;
} inData;
out vec4 fragColor;
View gist:da60e73576de5f453b8dadb2d8e63f4a
# crontab -l
59 09 * * 1-5 export DISPLAY=:0.0 && /usr/bin/play.sh
# ^---------- better to wrap the command to a script
# ^------make it launchable without display / terminal
#
# /usr/bin/play.sh
#!/bin/bash
/usr/bin/mplayer -vo null -vc dummy -really-quiet -volume 75 -loop 2 "$(ls /home/totetmatt/Music/JRMelody/* | shuf | head -n 1)" > /dev/null 2>&1
View gist:5d4e92406637ab8b2ec683c7e738a26f
#version 150
in VertexData
{
vec4 v_position;
vec3 v_normal;
vec2 v_texcoord;
} inData;
out vec4 fragColor;
@totetmatt
totetmatt / yougif.sh
Created Jan 17, 2020
Grab a video and create a gif from selected timestamp
View yougif.sh
# $1 = Video URL
# $2 = Time to start (format 00:00:00)
# $3 = Duration of sample (format 00:00:00)
# $4 = Output file
youtube-dl -f mp4 \
$1 \
-o - \
| ffmpeg -i pipe: \
-ss $2 \
-t $3 \