- Do you have an Github account ? If not create one.
- Install required tools
- Latest Git Client
- gpg tools
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
# Ubuntu
sudo apt-get install gpa seahorse
# MacOS with https://brew.sh/
require 'socket' | |
# 1. Create | |
# AF_INET means IPv4 (xxx.xxx.xxx.xxx) | |
# SOCK_STREAM means communicating with a stream (TCP) | |
# | |
# Can be simplified to symbols :INET and :STREAM, respectively | |
server = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM) |
<?php | |
function cidr_match($ip) { | |
foreach(file('https://www.cloudflare.com/ips-v4') as $cidr) { | |
list($subnet, $mask) = explode('/', $cidr); | |
if ((ip2long($ip) & ~((1 << (32 - $mask)) - 1) ) == ip2long($subnet)) { | |
return true; |
openssl pkcs7 -print_certs -in old.p7b -out new.crt | |
# openssl pkcs7 -print_certs -in old.p7b -out new.cer |
// include the AMQPlib Classes || use an autoloader | |
// queue/exchange names | |
$queueRightNow = 'right.now.queue'; | |
$exchangeRightNow = 'right.now.exchange'; | |
$queueDelayed5sec = 'delayed.five.seconds.queue'; | |
$exchangeDelayed5sec = 'delayed.five.seconds.exchange'; | |
$delay = 5; // delay in seconds | |
<?php | |
/* | |
* Get all users registered after $start and before $end (dates in yyyy-mm-dd format) | |
* | |
* Based on my answer to this question: http://wordpress.stackexchange.com/questions/51485/how-can-i-query-all-users-who-registered-today/51492#51492 | |
* | |
* @param (string) $start - start date in yyyy-mm-dd format | |
* @param (string) $end - end date in yyyy-mm-dd format | |
*/ | |
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'aws-sdk' | |
#creates an interface object to AWS S3 | |
AWS.config( :access_key_id => '' , :secret_access_key => '' ) | |
#creates an interface to the S3 | |
s3interface = AWS::S3.new | |
<?php | |
/* | |
参考自: | |
http://darklaunch.com/2010/09/01/http-status-codes-in-php-http-header-response-code-function | |
http://snipplr.com/view/68099/ | |
*/ | |
function HTTPStatus($num) { | |
$http = array( |
#!/usr/bin/env ruby | |
# List all keys stored in memcache. | |
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
require 'net/telnet' | |
headings = %w(id expires bytes cache_key) | |
rows = [] |