This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** A simple echo page in PHP | |
* | |
* It just outputs the request it received back, including HTTP headers. | |
*/ | |
if (!function_exists('getallheaders')) { | |
// Polyfill for PHP<7.3 | |
function getallheaders() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eu | |
# | |
# Test script to read from a Kinesis Data Stream | |
# | |
# Olivier Mehani <olivier.mehani@learnosity.com> | |
# | |
# Example usage: | |
# | |
# REGION=ap-southeast-2 AWS_PROFILE=playground ./read-stream.sh kinesis-cross-account-playground | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* dial.php - A simplistic one-page protocol handler for tel: schemes. | |
* | |
* Copyright (C) 2020 Olivier Mehani <shtrom@ssji.net> | |
* | |
* This renders a simple HTML form allowing to call a number, | |
* and to register itself as a protocol handler. | |
* | |
* Multiple devices are supported (see the `$devices` array), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$referenceMap = [ "sessRef1" => "ibkRef1", "sessRef2" => "ibkRef2", "sessRef3" => null, "sessRef1_2" => "ibkRef1" ]; | |
function test_funcs(array $map) { $values = array_values($map); $newMap = array_merge($map, array_combine($values, $values)); return $newMap; } | |
function test_foreach(array $map) { $newMap=[]; foreach($map as $k => $v) { $newMap[$k] = $v; $newMap[$v] = $v; } return $newMap; } | |
function fmicrotime_funcs($map, $count=10000) { $time=microtime(true); for($i=0;$i<$count;$i++) { test_funcs($map); }; $delta=microtime(true)-$time; echo $delta; }; | |
function fmicrotime_foreach($map, $count=10000) { $time=microtime(true); for($i=0;$i<$count;$i++) { test_foreach($map); }; $delta=microtime(true)-$time; echo $delta; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int doSomething(int n) | |
{ | |
for (int i = 1; i <= n; i++) | |
{ | |
for (int j = 1; j < n; j += i) | |
{ | |
// Some O(1) task | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# parameters | |
USERNAME="maybe empty" | |
PASSWORD="fritzbox-password" | |
CERTPATH="path to cert eg /etc/letsencrypt/live/domain.tld/" | |
CERTPASSWORD="cert password if needed" | |
HOST=http://fritz.box | |
# make and secure a temporary file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
http://www.openldap.org/faq/data/cache/347.html | |
As seen working on Ubuntu 12.04 with OpenLDAP 2.4.28-1.1ubuntu4 | |
Author: Roberto Aguilar <roberto@baremetal.io> | |
""" | |
import hashlib | |
import os |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Export Wallabag 1.9 (and maybe other 1.x) library. | |
* | |
* Olivier Mehani <shtrom+wallabag@ssji.net>, 2016 | |
* MIT license (same as Wallabag itself) | |
* | |
* Particularly useful in * case the normal export process dies with a message | |
* such as | |
* | |
* PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 74558957 bytes) in /srv/www/wallabag/inc/poche/Tools.class.php on line 231 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account. | |
Token for proof: | |
[Verifying my OpenPGP key: openpgp4fpr:4435cf6a7c8ddd9be2def5f9f012a6e298c66655] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
daemon_name=graphite-web | |
. /etc/rc.conf | |
. /etc/rc.d/functions | |
get_pid() { | |
echo `ps ax | grep [c]arbon-cache.py | awk '{ print $1; }'; \ | |
ps ax | grep [u]wsgi-graphite.yaml | awk '{ print $1; }'` |