sudo apt-get install autoconf automake libtool curl make g++ unzip -y
git clone https://github.com/google/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
make
make check
sudo make install
sudo ldconfig
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
import pexpect | |
child = pexpect.spawn ('mysql -umyuser -pmysupersecret -hxxx.xxx.xxx.xxx') | |
child.expect ('mysql> ') | |
child.sendline ('show databases;\n') | |
child.expect ('mysql> ') | |
print child.before | |
child.expect('mysql> ') | |
child.sendline ('show processlist;') | |
child.expect ('mysql> ') | |
print child.before |
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
// usage: {{ file.size | prettyBytes }} | |
Vue.filter('prettyBytes', function (num) { | |
// jacked from: https://github.com/sindresorhus/pretty-bytes | |
if (typeof num !== 'number' || isNaN(num)) { | |
throw new TypeError('Expected a number'); | |
} | |
var exponent; | |
var unit; | |
var neg = num < 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
/* | |
* WP REST API version 2.0-beta7 | |
* API base url ishttp://www.example.com/wp-json | |
* | |
* Reference | |
* https://wordpress.org/support/topic/new-post-with-image | |
*/ | |
/* | |
* Get Guzzle HTTP Client. That client has been authenticated. | |
*/ |
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 | |
/** | |
* Shorten large numbers into abbreviations (i.e. 1,500 = 1.5k) | |
* | |
* @param int $number Number to shorten | |
* @return String A number with a symbol | |
*/ | |
function numberAbbreviation($number) { | |
$abbrevs = array(12 => "T", 9 => "B", 6 => "M", 3 => "K", 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
docker ps | awk {' print $1 '} | tail -n+2 > tmp.txt; for line in $(cat tmp.txt); do docker kill $line; done; rm tmp.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
<?php | |
$countries = array | |
( | |
'AF' => 'Afghanistan', | |
'AX' => 'Aland Islands', | |
'AL' => 'Albania', | |
'DZ' => 'Algeria', | |
'AS' => 'American Samoa', | |
'AD' => 'Andorra', |