Skip to content

Instantly share code, notes, and snippets.

View cskonopka's full-sized avatar
📺
stuck inside a television

Christopher Konopka cskonopka

📺
stuck inside a television
View GitHub Profile
for f in ./*.mp4
do ffprobe -v quiet -of csv=p=0 -show_entries format=duration "$f"
done | awk '{sum += $1}; END{print sum}'
@cskonopka
cskonopka / btc-html5-webgl.html
Created June 13, 2023 22:13
Bitcoin Ordinal HTML5 + WebGL example
<html>
<script type="text/javascript">
var GL;
var shaderId;
var vertexBuffer;
var indexBuffer;
var timer = 0;
function initWebGL(){
#!/bin/bash
n=0;
for file in *.jpg ; do mv "${file}" "${n}".jpg; n=$((n+1)); done
@cskonopka
cskonopka / aptiv-install.sh
Last active March 25, 2020 07:22
A fresh rpi install for python3 and flask.
#!/bin/bash
# Update
sudo apt-get update
# Install GPIO lib
sudo pip3 install --upgrade RPi.GPIO
# Install Git
sudo apt install git
# Install Python3 from source
sudo su
@cskonopka
cskonopka / docker-RemoveAllContainersImages.sh
Created December 31, 2019 04:48
Remove all Docker Containers and Images from operating system
#!/bin/bash
# remove all Docker containers
docker rm $(docker ps -a -q)
# remove all Docker images
rmi $(docker images -a -q)
@cskonopka
cskonopka / ffmpeg-CreatePngPaletteGif.sh
Created August 3, 2019 03:05
Search a directory for .mp4 files, create a .png using the "palettegen" filter and then generate a new gif using the .png and source .mp4
#!/bin/bash
echo "Provide a directory please :"
read dir
for f in $dir/*.mp4
do
echo "Processing $f"
echo "${f%.*}.png"
ffmpeg -y -ss 0 -t 11 -i $f -filter_complex "[0:v] palettegen" "${f%.*}.png"
ffmpeg -ss 0 -t 11 -i $f -filter_complex "[0:v] fps=24,scale=w=480:h=-1,split [a][b];[a] palettegen=stats_mode=single [p];[b][p] paletteuse=new=1" "${f%.*}.gif"
done
@cskonopka
cskonopka / CompositionExample.go
Created June 12, 2019 04:34
Example of Golang Composition from adrianlabs
// All material is licensed under the Apache License Version 2.0, January 2004
// http://www.apache.org/licenses/LICENSE-2.0
// https://play.golang.org/p/uB4c33sbfj
// Sample program demonstrating decoupling with interface composition.
package main
import "fmt"
@cskonopka
cskonopka / readCSV.go
Created May 6, 2019 18:06
Basic example how to read a CSV file and add it's contents to a new data object in Go.
package main
import (
"encoding/csv"
"fmt"
"os"
)
type CsvLine struct {
Column1 string
@cskonopka
cskonopka / ffmpeg-sequentialMerge.go
Created April 17, 2019 22:09
Use ffmpeg to sequentially overlay a folder of audio files
package main
import (
"fmt"
"os/exec"
"strconv"
)
func main() {
countdown(4)
@cskonopka
cskonopka / ffmpeg-overlay2audiofiles.sh
Last active April 17, 2019 21:10
ffmpeg: Overlay 2 audio files
#!/bin/bash
ffmpeg -y -i FILE1 -i FILE2 -filter_complex "[0:0][1:0] amix=inputs=2:duration=longest" -c:a libmp3lame OUTPUTFILE