Skip to content

Instantly share code, notes, and snippets.

@dmertl
dmertl / Cassandra data type byte sizes.txt
Last active February 3, 2024 16:44
Cassandra data type byte sizes
uuid: 16 bytes
timeuuid: 16 bytes
timestamp: 8 bytes
bigint: 8 bytes
counter: 8 bytes
double: 8 bytes
time: 8 bytes
inet: 4 bytes (IPv4) or 16 bytes (IPV6)
date: 4 bytes
float: 4 bytes
@dmertl
dmertl / Mac OS X Traktor Bluetooth Speaker
Last active February 3, 2024 16:44
Mac OS X Traktor Bluetooth Speaker
Plugin Z1
Connect to Bluetooth Speaker
Open Audio Midi Setup
Create new aggregate device
Select Z1 and Bluetooth Speaker
Add names to Bluetooth Speaker channels if they don't have any (little squares under subdevices)
Open / Restart Traktor
Select aggregate device as audio output
Set Z1 as main left/right
Set Bluetooth as monitor left/right
@dmertl
dmertl / readme.md
Created July 20, 2023 20:51
Character encoding tricks

If you see several weird characters in a row that look like incorrect character encoding there's a good chance it's UTF-8 interpreted as cp-1252. For example, “ in cp-1252 is 0xE2 0x80 0x9C. Those same 3 bytes in UTF-8, 0xE2809C is .

In MySQL you can do a quick conversion to check:

mysql> SELECT CONVERT(UNHEX(HEX(CONVERT("“" USING LATIN1))) USING utf8mb4);
+--------------------------------------------------------------------+
| CONVERT(UNHEX(HEX(CONVERT("“" USING LATIN1))) USING utf8mb4)     |
+--------------------------------------------------------------------+
| “ |
@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',
@dmertl
dmertl / planet_crafter_allowed_special_chars.md
Last active May 1, 2024 06:15
Planet Crafter Allowed Special Characters

Faces

😀☹😁😂😃😄😅
😆😉😊😋😍😎

Symbols

@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 / 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 / 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 / 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