I hereby claim:
- I am hongster on github.
- I am hongster (https://keybase.io/hongster) on keybase.
- I have a public key whose fingerprint is DAD6 71CB E980 8801 48B7 20C8 7C1C E5E3 11EC E1DC
To claim this, I am signing this object:
/** | |
* Simple AJAX call helper, with lock mechanism to prevent duplicated concurrent connections. | |
* It sends data in JSON format, you can easily adapt it to to your need. | |
* Dependencies: jQuery ($.ajax) and UnderscoreJS. You can easily remove UnderscoreJS code. | |
*/ | |
var API = new function() { | |
var self = this; | |
// Lock to prevent duplicated concurrent API calls. | |
self.locks = {}; |
/** | |
* Create a custom [build system](http://bit.ly/17IKkU9) to provide PHP syntax checking. | |
* Save this file as ~/.config/sublime-text-2/Packages/User/PHP.sublime-build | |
* | |
* Usage | |
* - In the editor, select a tab with PHP source code. | |
* - Press F7 or CTRL + B to run PHP syntax check. | |
* - The status will be be displayed in the console at the bottom. | |
* - If it shows error, press F4, and the editor cursor will be brought to the relevant line in the source code. | |
*/ |
<?php | |
function hexToStr($hex){ | |
$string=''; | |
for ($i=0; $i < strlen($hex)-1; $i+=2){ | |
$string .= chr(hexdec($hex[$i].$hex[$i+1])); | |
} | |
return $string; | |
} | |
$s = '6df157335e0253575c71533a53576d7759279053003100300037003953f7002000200068007400740070003a002f002f007700770077002e006700700073002e0063006f006d002f006d00610070002e0061007300700078003f006c00610074003d00320033002e0031003200330026006c006e0067003d003100310033002e003100320033'; |
<?php | |
function strToHex($string){ | |
$hex = ''; | |
for ($i=0; $i<strlen($string); $i++){ | |
$ord = ord($string[$i]); | |
$hexCode = dechex($ord); | |
$hex .= substr('0'.$hexCode, -2); | |
} | |
return $hex; | |
} |
<?xml version="1.0" encoding="utf-8"?> | |
<service> | |
<short>RabbitMQ Server</short> | |
<description>Robust messaging for applications</description> | |
<port protocol="tcp" port="5671"/> | |
<port protocol="tcp" port="5672"/> | |
</service> |
<?xml version="1.0" encoding="utf-8"?> | |
<service> | |
<short>RabbitMQ Management Console</short> | |
<description>Web interface for managing RabbitMQ</description> | |
<port protocol="tcp" port="15672"/> | |
</service> |
<?php | |
/** | |
* Generate random password of given length. | |
* | |
* @param int $length | |
* @return string | |
*/ | |
private function randomPassword($length = 6) { | |
// Non-ambiguous chars | |
$alphabet = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'; |
<?php | |
function randomPassword($length = 6) { | |
// Non-ambiguous chars | |
$alphabet = 'ABCDEFGHJKLMNPQRSTUVWXYZ23456789'; | |
$alphamax = strlen($alphabet) - 1; | |
$password = ''; | |
for ($i = 0; $i < $length; $i++) { | |
$password .= $alphabet[mt_rand(0, $alphamax)]; | |
} |
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env php | |
<?php | |
/* This script is designed to delete logs files if it exceeds a defined size limit. | |
* Size limit is applied to all log files, instead of individual file. | |
* The logs are sorted by filename in reversed alphabetical order. | |
* Each file's size is counted and sum with previous file. If size limit is exceeded, | |
* subsequent files are deleted. | |
*/ | |
const MB = 1024 * 1024; |