Skip to content

Instantly share code, notes, and snippets.

@cletusw
cletusw / git-sync-ship.sh
Created September 14, 2017 20:35
Git aliases for an easier rebase workflow
git config --global alias.sync '!f() { echo "$(tput setaf 4)Syncing this branch with origin master$(tput sgr 0)" && git fetch origin master && git rebase origin/master && echo "$(tput setaf 2)Branch sync successful$(tput sgr 0)"; }; f'
git config --global alias.ship '!f() { BRANCH=$(git symbolic-ref --short HEAD) && MERGE_BASE=$(git merge-base origin/master HEAD) && NUM_COMMITS=$(git rev-list --count $MERGE_BASE..) && git log --oneline --stat $MERGE_BASE.. && read -p "$(tput setaf 4)Are you sure you want to ship $(tput bold)$NUM_COMMITS$(tput sgr 0)$(tput setaf 4) commits to $(tput bold)master$(tput sgr 0)? [Y/n] " response </dev/tty && case $response in [yY][eE][sS]|[yY]|"") echo "$(tput setaf 4)Shipping branch $(tput bold)$BRANCH$(tput sgr 0)" ;; *) echo "$(tput setaf 1)Ship aborted by user$(tput sgr 0)"; return 1 ;; esac && git checkout master && (git merge --ff-only - || (echo "$(tput setaf 1)Could not merge branch into local master\nRun git sync before running this command\nIf this error persists, you ha
@cletusw
cletusw / video-recorder.js
Created April 24, 2021 17:02
Video recorder custom element
import { html, css, LitElement } from 'lit';
import { ref, createRef } from 'lit/directives/ref.js';
export class VideoRecorder extends LitElement {
static get styles() {
return css`
video {
background: #222;
--width: 100%;
width: var(--width);
import time
import psutil
import pyautogui
# Check https://youtu.be/OGKQ6krf5O0 for a demo
# Required software
# Python 3 (https://www.python.org/downloads/) (with installation: check add to PATH)
# psutil (pip install psutil)
# pyautogui (pip install pyautogui)
@cletusw
cletusw / process_for_atem.bat
Last active March 23, 2023 16:58
Windows batch script that prepares (pre-multiplies) an image file for use as an overlay on an ATEM video switcher (see https://www.youtube.com/watch?v=N2vLs9i0bA0 and https://stackoverflow.com/questions/6591361/method-for-converting-pngs-to-premultiplied-alpha#comment74190171_27177752 ). Requires ImageMagick: https://imagemagick.org/script/downl…
@echo off
rem Source: https://gist.github.com/cletusw/648076667040699f9ec148b322e76a4e
if "%~1"=="" goto :usage
if not "%~2"=="" goto :usage
set "OUTPATH=%~dp1processed\"
if not exist "%OUTPATH%" (
mkdir "%OUTPATH%"
)