Skip to content

Instantly share code, notes, and snippets.

View matthiasg's full-sized avatar

matthiasg matthiasg

View GitHub Profile
@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 / GStreamer.md
Created February 25, 2020 08:40
GStreamer Notes for WebRTC with Windows Camera Source
> gst-device-monitor-1.0.exe
   
   
   ...
    
Device found:

	name  : 00 Pro Capture AIO
	class : Video/Source
@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 / server_csr_details.txt
Last active March 5, 2020 08:28
Self Signed SSL Certificate with SubjectAltName and signed by Self Signed Certificate Authority
[req]
default_bits = 2048
prompt = no
default_md = sha256
req_extensions = v3_req
distinguished_name = dn
[ dn ]
C= CountryCode
ST= State
@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 / 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 / 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 / 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 / HOWTO.md
Created December 2, 2021 12:07
NFS Share Smartos NFS

First create a share zfs create zones/camera

Share with access to all intranet pcs with write access as root

zfs set sharenfs='sec=none,rw=*,anon=0' zones/camera

Note: sec=none must PRECEED any following option see man share_nfs

@matthiasg
matthiasg / audit.js
Last active September 21, 2023 12:12
common/scripts/audit.js - for @microsoft/rush
const fs = require('fs')
const path = require('path')
const child_process = require('child_process')
const pnpmPath = path.resolve(__dirname, '../temp/pnpm-local/node_modules/pnpm/bin/pnpm.cjs')
const tempPath = path.resolve(__dirname, '../temp')
let argv = process.argv.slice(2)
// Simple order fix to avoid building or required a full parser (only works with the two specific parameters basically)