Skip to content

Instantly share code, notes, and snippets.

View MichaelPaulukonis's full-sized avatar

Michael Paulukonis MichaelPaulukonis

View GitHub Profile
@MichaelPaulukonis
MichaelPaulukonis / linkify.js
Created October 10, 2013 14:04
simple linkify (from MS Visual Studio upgrade report). See also: http://benalman.com/code/projects/javascript-linkify/examples/linkify/
// Linkifies the specified text content, replaces candidate links with html links
function linkify(text)
{
if(!text || 0 === text.length)
{
return text;
}
// Find http, https and ftp links and replace them with hyper links
var urlLink = /(http|https|ftp)\:\/\/[a-zA-Z0-9\-\.]+(:[a-zA-Z0-9]*)?\/?([a-zA-Z0-9\-\._\?\,\/\\\+&%\$#\=~;\{\}])*/gi;
@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 / 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'
@MichaelPaulukonis
MichaelPaulukonis / a.notes.md
Last active May 11, 2023 11:36
Github repo as narrative
@MichaelPaulukonis
MichaelPaulukonis / vasarely.dime.pde
Created February 19, 2014 04:32
dime-story vasarely (processing sketch)
// Inspired by Victor Vasarely*, I created a mechanistic color grid with inset squares or rectangles.
// The color palette was primarily built using a Complementary set of reds and greens,
// with a hand-picked blue and yellow for added vibrancy.
// The algorithm prohibits the horizontal repetition of a background color,
// and will not alow an inset-shape to be the same color as the background.
// * particularly by http://4.bp.blogspot.com/-JvA1kOVrVoQ/TbtLGxQ7fxI/AAAAAAAAAZU/n8wyXMlmDus/s1600/colour_vasarely5.jpg
// found, charmingly enough, at http://mrswagnersartideas.blogspot.com/2011/04/victor-vasarely.html
// two early palettes.
@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
// -------------------------------------
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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