Skip to content

Instantly share code, notes, and snippets.

View MichaelPaulukonis's full-sized avatar

Michael Paulukonis MichaelPaulukonis

View GitHub Profile
@MichaelPaulukonis
MichaelPaulukonis / gist_maker.md
Last active March 14, 2025 15:23
How to make a gist from the command-line
@MichaelPaulukonis
MichaelPaulukonis / repo_magic.md
Created March 14, 2025 15:01
Cross-repo replacement while preserving both histories and not doing a lot of manual stuff
# Navigate to your existing repository
cd /path/to/existing/repo

# Add the new repository as a remote
git remote add new-repo /path/to/new/repo

# Fetch the branch from the new repository
git fetch new-repo branch-name
@MichaelPaulukonis
MichaelPaulukonis / magick.md
Last active August 31, 2023 23:19
ImageMagick + related scripts, one-liners etc.

imagemagick

  • converts webp to png 1 for x in *.webp; do dwebp {} -o ${x%.*}.png ::: $x; done
  • convert transparent pngs to white background (multiple files w/ renaming)
    • convert '*.png' -background white -alpha remove -alpha off -set filename:fn '%[basename]-white' '%[filename:fn].png'

ImageMagick CLI

Separate image into discrete channels, colored as channel

@MichaelPaulukonis
MichaelPaulukonis / keybindings.json
Last active March 11, 2022 14:21
VS Code settings
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+`",
"command": "workbench.action.terminal.focus",
"when": "!terminalFocus"
},
{
"key": "ctrl+tab",
"command": "workbench.action.terminal.focusNext",
// Create photomosaics from a source image and a directory of tile images.
// by Greg Borenstein, January 2013
// Read more here: http://www.urbanhonking.com/ideasfordozens/2013/01/14/making-photomosaics-in-processing/index.html
// NOTE: based on luminance (white/black) only, NOT HUE
// see inline comments for more details
// -------------------------------------
@MichaelPaulukonis
MichaelPaulukonis / ffmpeg_notes.md
Last active August 3, 2023 04:38
Commands and notes on my use of ffmpeg (and ImageMagick, as it pertains)

ffmpeg commands

Some of these DO NOT WORK and I'm not sure why they are here ugh

ffmpeg -r 15 -f image2 -s 500x500 -pattern_type glob -i '*.png' -vcodec libx264 -crf 17 -pix_fmt yuv420p 'combined.mp4'

ffmpeg -r 3 -f image2 -pattern_type glob -i '*.png' -vf "pad=ceil(iw/2)*2:ceil(ih/2)*2" -vcodec libx264 -crf 17 -pix_fmt yuv420p 'combined.mp4'

ffmpeg -r 3 -f image2 -pattern_type glob -i '*.png' -vf scale=-2:2048 -vcodec libx264 -crf 17 -pix_fmt yuv420p 'combined.mp4'
In recent days (the last 12-24 hours), there have been a couple of posts on a one
'Marak Squires', who goes by the tag JimBastard. He stands accused of stealing code,
and being a general douchebag. Stealing code isn't good. Being a douchebag isn't
acutally illegal. However, the way that the campaign against him has been carried
out worries me.
The post to reddit that brought this issue to attention was entitled 'Code Thief at
Large: Marak Squires / JimBastard'. It can be found here:
http://www.reddit.com/r/programming/comments/ebge2/code_thief_at_large_marak_squires_jimbastard/.
It was a link to a github gist that can be found here:

Imperfect Circles

Pleasantly imperfect spots drawn on the canvas. Imperfection created by fractal subdivision. [Updated: I forgot to close the curves with context.closePath();]

A Pen by Dan Gries on CodePen.

License.

@MichaelPaulukonis
MichaelPaulukonis / wizard.monkeys.txt
Created April 18, 2017 17:33
Lindenmayer System (l-system) poetry test
rules: {"start":"P","rules":{"P":"P+P[PN]T","T":"PP"}}
instructions: P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP[P+P[PN]T+P+P[PN]T[P+P[PN]TN]PPN]P+P[PN]TP+P[PN]T+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP[P+P[PN]T+P+P[PN]T[P+P[PN]TN]PPN]P+P[PN]TP+P[PN]T[P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP[P+P[PN]T+P+P[PN]T[P+P[PN]TN]PPN]P+P[PN]TP+P[PN]TN]P+P[PN]T+P+P[PN]T[P+P[PN]TN]PPP+P[PN]T+P+P[PN]T[P+P[PN]TN]PP+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP[P+P[PN]T+P+P[PN]T[P+P[PN]TN]PPN]P+P[PN]TP+P[PN]T+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP[P+P[PN]T+P+P[PN]T[P+P[PN]TN]PPN]P+P[PN]TP+P[PN]T[P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP[P+P[PN]T+P+P[PN]T[P+P[PN]TN]PPN]P+P[PN]TP+P[PN]TN]P+P[PN]T+P+P[PN]T[P+P[PN]TN]PPP+P[PN]T+P+P[PN]T[P+P[PN]TN]PP[P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP[P+P[PN]T+P+P[PN]T[P+P[PN]TN]PPN]P+P[PN]TP+P[PN]T+P+P[PN]T+P+P[PN]T[P+P[PN]TN]PP+P+P[PN]T+P+P[PN]T[P+P[
@MichaelPaulukonis
MichaelPaulukonis / zipper.js
Created February 27, 2017 19:56
renames and zips recursive files
'use strict';
// https://gist.github.com/VinGarcia/ba278b9460500dad1f50
// List all files in a directory in Node.js recursively in a synchronous fashion
let walkSync = function(dir, filelist) {
if (dir[dir.length-1] != `/`) { dir = dir.concat(`/`); }
var files = fs.readdirSync(dir);
filelist = filelist || [];