Skip to content

Instantly share code, notes, and snippets.

@AbeEstrada
AbeEstrada / gist:5e7b63f78b7e2f5e27e913968b4618ea
Created November 22, 2024 18:18
ffmpeg: convert transparent png files to mov with alpha channel support
ffmpeg -framerate 30 -i frame_%03d.png -c:v prores_ks -profile:v 4444 -pix_fmt yuva444p10le -alpha_bits 8 -q:v 20 output.mov
@AbeEstrada
AbeEstrada / sudoku.js
Created October 21, 2024 22:42
Sudoku solver
// Based on: https://dfns.dyalog.com/n_sudoku.htm
// x(,/{@[x;y;]'(!10)^x*|/p[;y]=p,:,3/:-3!p:!9 9}')/&~*x
const solveSudoku = (board) => {
const grid = Array.isArray(board[0])
? board
: Array.from({ length: 9 }, (_, i) => board.slice(i * 9, (i + 1) * 9));
if (solve(grid)) {
return grid;
@AbeEstrada
AbeEstrada / gist:18ae20e470c92e1abbd924e0548b8152
Last active October 14, 2024 15:31
Git pull from multiple directories
alias multipull='find . -mindepth 1 -maxdepth 1 -type d | while read -r dir; do echo "\033[32mUpdating:\033[0m $dir\n$(git -C "$dir" remote get-url origin 2>/dev/null || echo "No remote for $dir")"; git -C "$dir" pull || echo "Failed $dir"; echo; done'
@AbeEstrada
AbeEstrada / detect-feed.js
Created August 21, 2024 18:25
Detect rss/atom feed url
[...document.querySelectorAll( 'link[rel~=alternate][type="application/atom+xml"],' + 'link[rel~=alternate][type="application/rss+xml"],' + 'a[rel~=alternate][type="application/atom+xml"],' + 'a[rel~=alternate][type="application/rss+xml"]' )].map(link => link.href);
@AbeEstrada
AbeEstrada / file-splitter.sh
Created August 6, 2024 05:03
Move half of the files to one directory
#!/bin/bash
# Check if the correct number of arguments is provided
if [ "$#" -ne 3 ]; then
echo "Usage: $0 <source_directory> <destination1> <destination2>"
exit 1
fi
# Assign arguments to variables
source_dir="$1"
#!/bin/zsh
usage() {
echo "https://github.com/facefusion/facefusion"
echo "Usage: $0 -s source_image -t target_image [-r reference_face_position] [-e]"
echo " -s: Path to the source image"
echo " -t: Path to the target image"
echo " -r: Reference face position (default: 0)"
echo " -e: Toggle to remove the face enhancer (optional)"
exit 1
@AbeEstrada
AbeEstrada / device.py
Created February 19, 2024 19:30
Support MPS
device = 'cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu'
@AbeEstrada
AbeEstrada / loudness.sh
Last active October 14, 2024 15:25 — forked from kylophone/loudness.rb
FFmpeg loudnorm filter - dual pass loudness normalization example - http://k.ylo.ph/2016/04/04/loudnorm.html
#!/bin/bash
ffmpeg_bin="ffmpeg" # v7.1
target_il=-16.0
target_lra=11.0
target_tp=-1.0
samplerate="44100"
if [ "$#" -ne 2 ]; then
echo "Usage: $0 input.wav output.wav"
@AbeEstrada
AbeEstrada / disableChromeUpdates.sh
Created May 18, 2023 17:35
Disable Google Autoupdater on macOS
launchctl unload -w ~/Library/LaunchAgents/com.google.keystone.xpcservice.plist
launchctl unload -w ~/Library/LaunchAgents/com.google.keystone.agent.plist
echo > ~/Library/LaunchAgents/com.google.keystone.xpcservice.plist
echo > ~/Library/LaunchAgents/com.google.keystone.agent.plist
chmod 644 ~/Library/LaunchAgents/com.google.keystone.xpcservice.plist
chmod 644 ~/Library/LaunchAgents/com.google.keystone.agent.plist
sudo chown root ~/Library/LaunchAgents/com.google.keystone.xpcservice.plist
@AbeEstrada
AbeEstrada / index.mjs
Last active January 5, 2023 00:05
Privnote + AWS Lambda
import { S3Client, PutObjectCommand, GetObjectCommand, DeleteObjectCommand } from "@aws-sdk/client-s3";
const s3Client = new S3Client({ region: "us-east-1" });
const Bucket = "BUCKET_NAME_GOES_HERE";
export const handler = async (event) => {
let statusCode = 200;
let body = ``;
if (event.requestContext.http.method === "POST") {