Skip to content

Instantly share code, notes, and snippets.

@dmertl
dmertl / php_cheatsheet.md
Last active May 16, 2024 23:06
PHP Cheatsheet

Doc Comment Typing

PHPDoc, but specifically working with PHPStorm IDE.

/**
 * Array of datetimes like [DateTime(), DateTime()]
 * 
 * @var DateTime[]
 */
@dmertl
dmertl / 15s_clip.bat
Last active May 18, 2024 18:22
Windows FFmpeg Droppable Batch Files
:again
if "%~1" == "" GOTO done
ffmpeg.exe -i "%~1" -t 00:00:15 "%~n1_clip%~x1"
SHIFT
GOTO again
:done
@dmertl
dmertl / ffmpeg_cheatsheet.md
Last active February 1, 2025 21:33
FFmpeg Cheatsheet

15 second clip

ffmpeg -i in.mp4 -t 00:00:15 in_15s.mp4

clip to exact frames

ffmpeg.exe -i in.mp4 -vf "select=between(n\,100\,395),setpts=PTS-STARTPTS" -an out.mp4
@dmertl
dmertl / windows_cheatsheet.md
Last active May 18, 2024 18:03
Windows Cheatsheet

Batch File Droppable

Batch file that you can drag and drop multiple files onto and execute commands. Loops through all files, calls ffmpeg with file as input, and file with "_clip" inserted before the extension.

:again
  if "%~1" == "" GOTO done
    D:\Applications\ffmpeg\bin\ffmpeg.exe -i "%~1" -t 00:00:30 "%~n1_clip%~x1"
  SHIFT
GOTO again
@dmertl
dmertl / mysql_cheatsheet.md
Last active May 9, 2024 05:47
MySQL Cheatsheet

Don't print results (null pager)

mysql> pager > /dev/null
PAGER set to '> /dev/null'
mysql> SELECT 1;
1 row in set (0.00 sec)

mysql> pager
Default pager wasn't set, using stdout.
@dmertl
dmertl / javascript_cheatsheet.md
Last active May 16, 2024 21:01
Javascript Cheatsheet

Unique ID

// Generates a unique (enough) ID from current time in milliseconds + random
function uid() {
    return Date.now().toString(36) + Math.random().toString(36).substr(2, 12);
}

Watch for Elements Added to DOM

@dmertl
dmertl / tampermonkey_cheatsheet.md
Last active May 12, 2024 09:59
Tampermonkey Cheatsheet

Access Tab Data

// Get our tab object and save some data into it
GM_getTab(function(tab_self) {
    tab_self.created = Date.now();
    tab_self.location_href = window.location.href.toString();
    GM_saveTab(tab_self);
});
@dmertl
dmertl / planet_crafter_allowed_special_chars.md
Last active May 1, 2024 06:15
Planet Crafter Allowed Special Characters

Faces

πŸ˜€β˜ΉπŸ˜πŸ˜‚πŸ˜ƒπŸ˜„πŸ˜…
πŸ˜†πŸ˜‰πŸ˜ŠπŸ˜‹πŸ˜πŸ˜Ž

Symbols

@dmertl
dmertl / print_unicode.js
Last active May 5, 2024 02:55
Print unicode chars from names file
const SKIP_START = ['\t', '@', ';'];
const SKIP_WORDS = [
'<control>',
'<not a character>',
'MODIFIER',
'LEFT-TO-RIGHT',
'RIGHT-TO-LEFT',
'FORMATTING',
'SPACE',
'COMBINING',