Skip to content

Instantly share code, notes, and snippets.

@derhuerst
derhuerst / list.md
Last active May 15, 2024 17:12
VPS price & performance comparison
product price cores RAM SSD Geekbench ST Geekbench MT Geekbench version date of benchmark
Hetzner CP11 3,92€/m 1 2GB 20GB 691/710 686/712 5.x 2023-05-20
Hetzner CPX11 4,75€/m 2 2GB 40GB 869/856 1631/1626 5.x 2021-10-03
Hetzner CX21 5,83€/m 2 4GB 40GB 681/663 1279/1248 5.x 2022-07-18
Hetzner CPX21 8,21€/m 3 4GB 80GB [`9
/*
EXAMPLE MESSAGE
/poll "question?" "option 1" "option 2"
*/
/** Global Helpers
*
* console - A normal console instance
* _ - An underscore instance
@endolith
endolith / readme.md
Last active January 8, 2021 15:02
Unlock PDF restrictions shortcut for Windows

Install QPDF, and then edit this batch file with the correct path and create a shortcut to this batch file. Then you can Open With the shortcut file for quick access and it creates an unlocked version of a locked PDF in the same folder as the original.

@lgaetz
lgaetz / remotehintpoll.php
Last active December 7, 2021 21:18
Simple PHP script that checks the extension status at a remote PBX and updates a custom hint on the local pbx for proper BLF operation.
<?php
/**** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** ****
* remotehintpoll.php
*
* Created by Lorne Gaetz lgaetz@sangoma.com
*
* Latest version: https://gist.github.com/lgaetz/8545099
*
* Licensed under GNU GPL version 2 or any later verison.
@cou929
cou929 / detect-private-browsing.js
Last active May 1, 2024 21:07
Detect private browsing mode (InPrivate Browsing or Incognito).
function retry(isDone, next) {
var current_trial = 0, max_retry = 50, interval = 10, is_timeout = false;
var id = window.setInterval(
function() {
if (isDone()) {
window.clearInterval(id);
next(is_timeout);
}
if (current_trial++ > max_retry) {
window.clearInterval(id);
@nikic
nikic / bench.php
Last active November 2, 2023 22:49
Benchmark of call_user_func_array vs switch optimization vs argument unpacking syntax
<?php error_reporting(E_ALL);
function test() {}
$nIter = 1000000;
$argNums = [0, 1, 2, 3, 4, 5, 100];
$func = 'test';
foreach ($argNums as $argNum) {
@nicolargo
nicolargo / firewall.sh
Last active December 29, 2016 10:07
My firewall startup script
#!/bin/sh
#
# Simple Firewall configuration.
#
# Author: Nicolargo
#
# chkconfig: 2345 9 91
# description: Activates/Deactivates the firewall at boot time
#
### BEGIN INIT INFO
@yellowled
yellowled / ffmpeg-html5
Created December 6, 2011 19:39
Convert videos to proper formats for HTML5 video on Linux shell using ffmpeg. Will probably convert this to a bash script later, but for the time being, here's some examples. Not sure there have actually sensible dimensions and bitrates for web video.
# webm
ffmpeg -i IN -f webm -vcodec libvpx -acodec libvorbis -ab 128000 -crf 22 -s 640x360 OUT.webm
# mp4
ffmpeg -i IN -acodec aac -strict experimental -ac 2 -ab 128k -vcodec libx264 -vpre slow -f mp4 -crf 22 -s 640x360 OUT.mp4
# ogg (if you want to support older Firefox)
ffmpeg2theora IN -o OUT.ogv -x 640 -y 360 --videoquality 5 --audioquality 0 --frontend