Skip to content

Instantly share code, notes, and snippets.

View matthiasg's full-sized avatar

matthiasg matthiasg

View GitHub Profile
@matthiasg
matthiasg / MathBlock.css
Created June 21, 2021 07:24 — forked from BrianHung/MathBlock.css
MathBlock NodeView for TipTap
.ProseMirror .MathBlock pre {
background: var(--default-back);
color: rgb(var(--default-font));
font-size: 0.8em;
display: flex;
padding: 1em;
}
.ProseMirror .MathBlock {
display: flex;
@matthiasg
matthiasg / windows-10-pro-smartos-bhyve.md
Last active March 20, 2024 09:54 — forked from skirmess/windows-10-pro-smartos-bhyve.md
Windows 10 Pro Image for SmartOS Bhyve

Windows 10 Pro

Windows 10 Pro ISO

Create a fresh Windows 10 Pro ISO file with Microsofts Media Creation Tool. (I created a Windows 10 Pro 64 bit German ISO image)

Save the created image on your SmartOS global zone.

cp ... /zones/Windows10_64de.iso
@matthiasg
matthiasg / gist:660789bd961fc8607e21f85330a78d05
Created September 10, 2020 06:39 — forked from mattconnolly/gist:7804176
Upgrading pkgin repository for a SmartOS zone.

Upgrading SmartOS zone

Make a snapshot first! Upgrading from 2013Q1 to 2013Q3 because I needed newer nginx.

Update pkgin repository

edit the files at:

/opt/local/etc/pkg_install.conf

/opt/local/etc/pkgin/repositories.conf

@matthiasg
matthiasg / AdbCommands
Created March 12, 2020 15:06 — forked from Pulimet/AdbCommands
Adb useful commands list
adb help // List all comands
== Adb Server
adb kill-server
adb start-server
== Adb Reboot
adb reboot
adb reboot recovery
adb reboot-bootloader
@matthiasg
matthiasg / android-set-ntp-server.md
Created February 28, 2020 14:23
Set the NTP server of your android device
tags
Android
Android Things

Set the NTP server of your android device

@matthiasg
matthiasg / gist:1b55cb46786fd241931083f0280b40c8
Created November 15, 2019 08:17 — forked from chanks/gist:7585810
Turning PostgreSQL into a queue serving 10,000 jobs per second

Turning PostgreSQL into a queue serving 10,000 jobs per second

RDBMS-based job queues have been criticized recently for being unable to handle heavy loads. And they deserve it, to some extent, because the queries used to safely lock a job have been pretty hairy. SELECT FOR UPDATE followed by an UPDATE works fine at first, but then you add more workers, and each is trying to SELECT FOR UPDATE the same row (and maybe throwing NOWAIT in there, then catching the errors and retrying), and things slow down.

On top of that, they have to actually update the row to mark it as locked, so the rest of your workers are sitting there waiting while one of them propagates its lock to disk (and the disks of however many servers you're replicating to). QueueClassic got some mileage out of the novel idea of randomly picking a row near the front of the queue to lock, but I can't still seem to get more than an an extra few hundred jobs per second out of it under heavy load.

So, many developers have started going straight t

@matthiasg
matthiasg / small-arc.sh
Created August 15, 2019 12:21 — forked from RantyDave/small-arc.sh
Limit the SmartOS (and Solaris?) ARC to a maximum of 256Mb. Works live, no reboot needed :)
#!/bin/bash
echo "arc_stats::print -a arcstat_p.value.ui64" | mdb -kw > value.ui64
ui64=$(cat value.ui64)
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw
echo "arc_stats::print -a arcstat_c.value.ui64" | mdb -kw > value.ui64
ui64=$(cat value.ui64)
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw
echo "arc_stats::print -a arcstat_c_max.value.ui64" | mdb -kw > value.ui64
ui64=$(cat value.ui64)
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw
@matthiasg
matthiasg / small-arc.sh
Created August 15, 2019 12:21 — forked from RantyDave/small-arc.sh
Limit the SmartOS (and Solaris?) ARC to a maximum of 256Mb. Works live, no reboot needed :)
#!/bin/bash
echo "arc_stats::print -a arcstat_p.value.ui64" | mdb -kw > value.ui64
ui64=$(cat value.ui64)
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw
echo "arc_stats::print -a arcstat_c.value.ui64" | mdb -kw > value.ui64
ui64=$(cat value.ui64)
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw
echo "arc_stats::print -a arcstat_c_max.value.ui64" | mdb -kw > value.ui64
ui64=$(cat value.ui64)
echo "${ui64:0:16}/Z 0x10000000" | mdb -kw
@matthiasg
matthiasg / insert-signature-in-pdf.md
Created August 3, 2019 14:14 — forked from chrpinedo/insert-signature-in-pdf.md
How to insert your signature in a PDF file by using PDFtk

How to insert your signature in a PDF file by using PDFtk

Your signature in all the sheets

  1. convert the signature image to PDF file
convert firma.png firma.pdf
@matthiasg
matthiasg / insert-signature-in-pdf.md
Created August 3, 2019 14:14 — forked from chrpinedo/insert-signature-in-pdf.md
How to insert your signature in a PDF file by using PDFtk

How to insert your signature in a PDF file by using PDFtk

Your signature in all the sheets

  1. convert the signature image to PDF file
convert firma.png firma.pdf