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
# delete archived log files | |
sudo find . -type f -regextype posix-extended -iregex '.+\.(bz2|[gx7]z|old|zip|[0-9])' -delete |
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
@echo off | |
echo. | |
:: set the local (dynamic) port for the Socks5 proxy | |
set lport=3128 | |
:: ssh details | |
set rport=22 | |
set username=andrew | |
set hostname=myproxy.tld |
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 php | |
<?php | |
/** | |
* $extractPath must be writable by the user account used to launch this script | |
*/ | |
$extractPath = '/opt/.phpstorm'; | |
$versionPage = 'https://data.services.jetbrains.com/products/releases?code=PS&latest=true&type=release&_=' . time(); | |
#region Functions |
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 php | |
<?php | |
function ansi2html($text) { | |
return preg_replace('/\x1B\[m/', '', preg_replace_callback('/\x1B\[(\d+)m(.*?)\x1B\[m/m', function ($match) { | |
switch ($match[1]) { | |
case 31: $rgb = array(170, 0, 0); break; | |
case 32: $rgb = array(0, 170, 0); break; | |
case 36: $rgb = array(0, 170, 170); break; | |
default: $rgb = array(0, 0, 0); | |
} |
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 | |
$shm = shm_attach(ftok(__FILE__, 'p'), 1024, 0640); | |
shm_put_var($shm, 0, ''); | |
$sem = sem_get(ftok(__FILE__, 'p'), 1, 0640, 1); | |
for ($i = 0; $i < 10; $i++) { | |
if (0 === ($pid = pcntl_fork())) { | |
$pid = posix_getpid(); |
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 | |
function format_array(array $array, $cols = 4, $maxCols = 120, $itemPadCols = 4, $indentCols = 4) { | |
if (empty($array)) { | |
return null; | |
} | |
$itemMaxCols = floor(($maxCols - ($cols * $itemPadCols) - $indentCols) / $cols); | |
$lines = 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
#!/usr/bin/env php | |
<?php | |
/** | |
* Generates a naturally sortable UUID in a distributed environment. | |
* UUID's are 120-bit represented in base62 as 20 in length and are composed of: | |
* - a time stamp in microseconds (from 1970-01-01 until 3180-01-01; ~1,200 years if using a custom epoch) | |
* - the machine's MAC address | |
* - the running process' id | |
*/ | |
class UniqueId { |
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 | |
/** | |
* @param object $source The source object to retrieve references from | |
* @param mixed $target [Optional] | |
* <table> | |
* <tr><td> object </td><td> The destination object to copy references to </td></tr> | |
* <tr><td> string </td><td> The scope to access $source properties, | |
* e.g. a parent class to get private properties </td></tr> | |
* <tr><td> array </td><td> See $map </td></tr> |
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 php | |
<?php | |
// strip shebang for html requests | |
if (ob_get_level()) ob_end_clean(); | |
if (PHP_SAPI === 'cli') { | |
$host = '127.0.0.1'; | |
$port = mt_rand(31000, 60000); | |
$ffAllowPopup = true; |
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
class Command { | |
private static $descriptorSpec = array( | |
0 => array('pipe', 'r'), | |
1 => array('pipe', 'w'), | |
2 => array('pipe', 'w')); | |
private static $shellCache = array(); | |
private $command; | |
private $shell; |
OlderNewer