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 | |
error_reporting(E_ALL ^ E_NOTICE); | |
function findLCA( $root, $a, $b) | |
{ | |
// no root no LCA. | |
if (!$root) { | |
return null; | |
} |
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 hashlib | |
import hmac | |
import base64 | |
def make_digest(message, key): | |
key = bytes(key, 'UTF-8') | |
message = bytes(message, 'UTF-8') | |
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 | |
# Returns interesting information about a HTTP/S call | |
# http://chrisiona.com/post/125309997618/ttfb-a-bash-script-that-returns-interesting | |
curl -so /dev/null \ | |
-w "%{http_code}\tPre-Transfer: %{time_pretransfer}\tStart Transfer: %{time_starttransfer}\tTotal: %{time_total}\tSize: %{size_download}\n" \ | |
$1 | |
echo "" |
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 | |
# How to install PHP memcached on CentOS 6.5 | |
# Install dependencies | |
yum install cyrus-sasl-devel zlib-devel gcc-c++ | |
# Get the latest libmemcached | |
wget https://launchpad.net/libmemcached/1.0/1.0.16/+download/libmemcached-1.0.16.tar.gz | |
tar -xvf libmemcached-1.0.16.tar.gz |
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
from boto.dynamodb2.exceptions import ValidationException | |
from boto.dynamodb2.fields import HashKey, RangeKey | |
from boto.dynamodb2.layer1 import DynamoDBConnection | |
from boto.dynamodb2.table import Table | |
from boto.exception import JSONResponseError | |
from time import sleep | |
import sys | |
if len(sys.argv) != 3: | |
print 'Usage: %s <source_table_name> <destination_table_name>' % sys.argv[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
from boto.dynamodb2.exceptions import ValidationException | |
from boto.dynamodb2.fields import HashKey, RangeKey | |
from boto.dynamodb2.layer1 import DynamoDBConnection | |
from boto.dynamodb2.table import Table | |
from boto.exception import JSONResponseError | |
from time import sleep | |
import sys | |
if len(sys.argv) != 3: | |
print 'Usage: %s <source_table_name> <destination_table_name>' % sys.argv[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
#!/usr/bin/env python | |
# Find the IAM username belonging to the TARGET_ACCESS_KEY | |
# Requirements: | |
# | |
# Environmental variables: | |
# AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY | |
# python: | |
# boto |
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
package { | |
'jekyll': | |
ensure => installed, | |
provider => gem, | |
require => [ | |
Anyenv::Env::Install["anyenv_deploy_rbenv_${ruby_version}"], | |
Anyenv::Env::Default["anyenv_deploy_rbenv_default_${ruby_version}"], | |
]; | |
'rouge': | |
ensure => installed, |