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
Steps to reproduce: | |
# Make sure that in your redis.conf: | |
appendonly no | |
# Also make sure that, in your redis.conf: | |
dbfilename FOO-dump.rdb | |
save "900 1" | |
save "300 10" | |
save "60 10000" |
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 | |
$scheduler = new Scheduler(); | |
$batch = new Batch(new BatchContext(/* ... */), new ThrottleBatchStrategy()); | |
// Add jobs | |
$batch->addJob(new FooJob( new JobContext() )); |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
// Our input | |
$time = microtime(true); | |
// Determining the microsecond fraction | |
$microSeconds = sprintf("%06d", ($time - floor($time)) * 1000000); | |
// Creating our DT object | |
$tz = new DateTimeZone("Etc/UTC"); // NOT using a TZ yields the same result, and is actually quite a bit faster. This serves just as an example. |
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 | |
$networkEID = '0b3fe...a'; | |
$fileEID = 'af4e0...f' | |
// e.g.: 19c679c10770acc216c26045cc5406c8155 | |
$largeNumber = hash("sha1", $fileEID); | |
// Converting from base-16 to base-13 | |
$hash = gmp_strval(gmp_init($largeNumber, 16), 13); |
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 | |
/** | |
* This script will generate a bunch of random data to test the exhaustion of kernel entropy. | |
* | |
* @author Mark van der Velden <mark@dynom.nl> | |
* | |
* | |
* Entropy can be checked at: /proc/sys/kernel/random/entropy_avail | |
* | |
* Tools like RND-tools can help keep the entropy above acceptable ranges. While this doesn`t (necessarily) improve |
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
{ | |
"_links": { | |
"api-root:self": { "href": "orders" }, | |
"api-root:next": { "href": "orders?page=2" }, | |
"api-root:find": { "href": "orders{?id}", "templated": true }, | |
"api-root:admin": [ | |
{ "href": "admins/2", "title": "Fred" }, | |
{ "href": "admins/5", "title": "Kate" } | |
], | |
"_curies" : [ |
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 | |
$time = microtime(true); | |
$seconds = (int) $time; | |
$milliseconds = (int) ($time * 1000); | |
$microseconds = (int) ($time * 1000000); | |
$nanoseconds = (int) ($time * 1000000000); | |
echo "seconds : $seconds\n" |
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 | |
/** | |
* @author Mark van der Velden <mark@dynom.nl> | |
*/ | |
/* | |
* Given, the following specification: | |
* - part 1, 40 bits wide -- a number between 0 - 1099511627775 | |
* - part 2, 5 bits wide -- a number between 0 - 31 | |
* - part 3, 9 bits wide -- a number between 0 - 511 |
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 bash | |
# The arguments | |
ARGS="$@"; | |
PHP_EXEC="$( which php )" | |
# TRYING to obtain the path we're located in. | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
EXECUTABLE="$DIR/../tools/migrations/doctrine-migrations.phar" |