Skip to content

Instantly share code, notes, and snippets.

View MichaelPaulukonis's full-sized avatar

Michael Paulukonis MichaelPaulukonis

View GitHub Profile
@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 || [];
@MichaelPaulukonis
MichaelPaulukonis / pride.from.finnegans.wake.txt
Last active November 29, 2016 21:46
closest sentences via levenstein distance (first two chapters of PRIDE AND PREJUDICE)
Rise up now and aruse!
Caution!
It is how sweet from her, the wispful, and they are soon seen swopsib so a sautril as a meise.
Our people here in Samoanesia will not be after forgetting you and the elders luking and marking the jornies, chalkin up drizzle in drizzle out on the four bare mats.
@MichaelPaulukonis
MichaelPaulukonis / songstory.txt
Created November 15, 2016 03:12
NaNoGenMo 2016 - story told by a child
Did you ever hear about the Princess who made friends with a real live sign? The sign's name was Ice Skate and the Princess's name was Diamonds.
They decided to play a game.
The game was hide-and-seek.
Diamonds said "First you hide, then I'll find you!" "Okay!" said Ice Skate.
They decided to play a game.