Skip to content

Instantly share code, notes, and snippets.

View Pierstoval's full-sized avatar
🌖

Alex Rock Pierstoval

🌖
View GitHub Profile
@Pierstoval
Pierstoval / imagemagick_geometry.php
Last active January 9, 2020 15:24
This enormous regexp matches any "Geometry" parameter for ImageMagick. See the docs about this: http://www.imagemagick.org/script/command-line-processing.php#geometry
<?php
$number = "\d*(?:\.\d+)?"; // It's a reference to use in other cases that matches any kind of number/float
$width = "(?<w>(?:$number)?%?)?"; // This is the first part, the width
$height = "(?:x(?<h>(?:$number)?%?))?"; // Here is the height, the same as "width" but starting with an "x"
$aspect = "[!><@^]"; // These are the different filters one can use to stretch, shrink, etc.
$size = "$width$height"; // To match any size we need width and height at least (aspect comes later)
@porjo
porjo / timelapse.md
Last active May 25, 2023 16:14
ffmpeg time-lapse

Convert sequence of JPEG images to MP4 video

Simple glob:

ffmpeg -r 24 -i '*.JPG' -s hd1080 -vcodec libx264 timelapse.mp4

Start from DSC_0079.JPG

ffmpeg -r 24 -f image2 -start_number 79 -i DSC_%04d.JPG -s hd1080 -vcodec libx264 timelapse2.mp4
@imjasonh
imjasonh / markdown.css
Last active February 12, 2024 17:18
Render Markdown as unrendered Markdown (see http://jsbin.com/huwosomawo)
* {
font-size: 12pt;
font-family: monospace;
font-weight: normal;
font-style: normal;
text-decoration: none;
color: black;
cursor: default;
}
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active April 22, 2024 16:30
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).