Skip to content

Instantly share code, notes, and snippets.

View gnat's full-sized avatar
:shipit:
ez pz lemon squeezy

Nathaniel Sabanski gnat

:shipit:
ez pz lemon squeezy
  • Vancouver, Canada
View GitHub Profile
@gnat
gnat / sample.md
Last active June 16, 2022 09:39
Odysee does not have trivial embeds yet

You can generate YouTube embed codes by just re-using the ID found in the browser bar. Typical users know only the link they see in the browser bar.

We need a way to get an embed link without scraping please! Youtube and Vimeo both allow it.

This is a note for the devs at Odysee. Hello :)

Vimeo

The URL from the browser window itself: https://vimeo.com/35477260 With 35477260 we can trivially generate the embedded code:

{
"ignored_packages":
[
"Vintage",
],
"color_scheme": "InvaderZim.sublime-color-scheme",
"theme": "Adaptive.sublime-theme",
"gtk_client_side_window_decorations": false,
"font_face":"SF Mono Semibold",
"line_padding_bottom": -1,
@gnat
gnat / Adaptive.sublime-theme
Last active August 17, 2023 03:32
Sublime: Preferences -> Customize Theme...
{
"variables":
{
"font_face": "Ubuntu Mono",
//"font_face": "Noto Sans Mono Bold",
"font_size_sm": 14,
"font_size": 14,
"font_size_lg": 10,
"font_size_title": 14,
  • FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. Typically you can use it in command lines or GUI, and many popular video editors are developed based on FFmpeg. Some usage examples are as follows:
    • Transcoding: ffmpeg -i input.mp4 output.avi
    • Video clipping: ffmpeg -i input.mkv -ss 11 -to 15 out.mkv to get a video clip from 11 second to 15 second. You can also replace -ss 11 -to 15 with -ss 00:00:11 -to 00:00:15 or -ss 00:11 -to 00:15 or -ss 00:11 -t 5 where parameter -t devotes time duration.
    • Video Frame screenshot: ffmpeg -i input.mkv -ss 5 -vframes 1 img.jpg to get the 1st frame in the selected second.
    • Watermark: ffmpeg -i input.mkv -i logo.png -filter_complex "[1]scale=192:108[b];[0][b]overlay=20:20" output.mkv with parameter scale for resizing watermark and overlay for watermark location (top-left pixel location). Use -filter_complex "overlay=20:20" instead if you don't need to scale wat
Arch: win64
Creation_Date:
Custom_Path: false
DLL_Overrides: {}
DXVK:
Environment: Custom
Environment_Variables: {}
Installed_Dependencies:
- allfonts
- dotnet40
PHP Scaling Notes
* Keeping latency down is #1 priority when using PHP.
* Lots of workers = thread swapping will tank CPU.
* 100-200 workers = they will all fill up and CPU will be unused.
* Ideally you just want to keep most requests UNDER 1 Second.
* Best under 0.1 Second. You start to hit Sqlite cap at that point.
* “Jobs” would just be a cron that runs in the background one at a time.
* Every page that goes over this latency will become a bottleneck.
* Most efficient by far for low-blocking is one big static FPM process.
* Adjusting static pm.max_children is superior to multiple VM’s.
@gnat
gnat / vm_notes.md
Last active April 28, 2024 23:37
VM Notes

Sane, modern setup

Bridge is a waste of time: Use the successor macvtap / macvlan "Direct Connect". The only downside is you cannot see the vm host from a vm.

Cockpit Setup for VM Host.

  1. Download your ubuntu iso and copy to /opt/. Cockpit will error if it's in your /home/.
  2. sudo apt install cockpit cockpit-machines
  3. Want to use Direct Attachment? (no bridge)
    • Prevent bridge device creation on startup. (Auto-generated by virsh)
@gnat
gnat / sqlite.md
Last active February 22, 2024 00:37
Compile new branch of SQLite for PHP and Python

High performance SQLite. WAL2, BEGIN CONCURRENT.

Tested, Ubuntu 22.04 +

  • WAL: Writes no longer block reads.
  • WAL2: Applying WAL no longer blocks writes (2 staggered WAL files).
  • BEGIN CONCURRENT: Writes no longer block entire file, only page-level. Transactions defer write until COMMIT; instead of entire transaction.

Find branch and get source

@gnat
gnat / trello_discord.md
Last active April 6, 2023 20:54
Trello notification to Discord webhook using trigger (NO zapier or bs)

NO ZAPIER!

Select Board

➡️ Automation

➡️ Rules

➡️ Create Rule

@gnat
gnat / mariadb_mysql_portable_no_install.md
Last active April 9, 2024 06:15
Portable Database - Standalone MariaDB and MySQL zero install.

Database Standalone Quickstart

🐬 = MySQL 8
🦭 = MariaDB

Why?

  • Localize your database into one single folder of your choosing.
  • No sudo / root requirement.
  • Run multiple database at the same time on the same machine- Full bare metal performance.