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 | |
/** | |
* Imagine if this came from the request or a database entry editable by the user. | |
* The Laravel URL validator relies on PHP's filter_var() method which considers | |
* file:// and php:// valid URLs. The vast majority of Laravel users probably | |
* expect this validator to only validate http:// & https:// | |
* @link http://www.php.net/manual/en/wrappers.php | |
*/ |
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
[unix_http_server] | |
file=/tmp/supervisor.sock ; (the path to the socket file) | |
[inet_http_server] ; inet (TCP) server disabled by default | |
port=*:9001 ; (ip_address:port specifier, *:port for all iface) | |
[supervisord] | |
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log) | |
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) | |
logfile_backups=10 ; (num of main logfile rotation backups;default 10) |
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 | |
# /app/start/global.php | |
/* | |
This results in several dated log files | |
/app/storage/logs/log-apache2handler-2014-02-02.txt | |
/app/storage/logs/log-apache2handler-2014-02-03.txt |
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 script loops though the list of collection names in a MongoDB and runs the compact operation on them | |
// Simply paste this into the Mongo shell | |
use testDbName; | |
db.getCollectionNames().forEach(function (collectionName) { | |
print('Compacting: ' + collectionName); | |
db.runCommand({ compact: collectionName }); | |
}); |
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
wget http://dl.fedoraproject.org/pub/epel/6/SRPMS/gearmand-1.1.8-2.el6.src.rpm | |
yum install rpm-build libuuid-devel boost-devel boost-thread sqlite-devel tokyocabinet-devel libevent-devel libmemcached-devel memcached gperf postgresql-devel gperftools-devel | |
rpmbuild --rebuild ~/gearmand-1.1.8-2.el6.src.rpm | |
rpm -Uhv ~/rpmbuild/RPMS/x86_64/*.rpm | |
service gearmand start |
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
Saw this interesting PHP Challenge. | |
Replace SOMETHING so that the output is Hello World. | |
if (SOMETHING) { | |
echo "Hello"; | |
} else { | |
echo "World"; | |
} |
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
# Install IUS and EPEL yum repos | |
wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/5/x86_64/epel-release-5-4.noarch.rpm | |
wget http://dl.iuscommunity.org/pub/ius/stable/CentOS/5/x86_64/ius-release-1.0-11.ius.centos5.noarch.rpm | |
rpm -i ius-release-1.0-11.ius.centos5.noarch.rpm epel-release-5-4.noarch.rpm | |
# make sure your system is up to date for good measure | |
yum update | |
# Install the required packages | |
yum install libgearman-devel php53u-devel gcc |
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 | |
foreach (hash_algos() as $algo) { | |
$start_time = microtime(TRUE); | |
for ($index = 0; $index <= 500000; $index++) { | |
$hash = hash($algo, $index); | |
} |
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 | |
# Generate a changelog between the v1 and v2 tags | |
# See the "pretty formats" section of the git manual if you want to customize the output: https://www.kernel.org/pub/software/scm/git/docs/git-log.html | |
git log --no-merges --format="%an: %s" v1..v2 | |
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 | |
$data = range(0, 1000000); | |
echo sprintf('%02.2f', (memory_get_usage() / 1048576))." MB of memory used\n"; | |
// output: 137.92 MB of memory used | |
foreach ($data as $key => $val) { | |
//echo "key: ".$key." value: ".$val."\n"; |
NewerOlder