Skip to content

Instantly share code, notes, and snippets.

@heskyji
heskyji / gist:c44d19739a2bd554fcee
Last active August 29, 2015 14:18
install gem using puppet package
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,
#!/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
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]
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]
@heskyji
heskyji / pecl-memcached.sh
Last active September 24, 2015 18:45 — forked from paul91/pecl-memcached.sh
How to install php memcached on CentOS 6.5
#!/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
@heskyji
heskyji / ttfb.sh
Last active March 29, 2017 09:22 — forked from chrisiona/ttfb.sh
TTFB – Bash script that returns interesting information about a HTTP/S call
#!/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 ""
@heskyji
heskyji / hmac_sha1.py
Created September 17, 2015 01:08
Generate HMAC-SHA1 Signature using Python 3
import hashlib
import hmac
import base64
def make_digest(message, key):
key = bytes(key, 'UTF-8')
message = bytes(message, 'UTF-8')
@heskyji
heskyji / lca.php
Last active September 29, 2016 04:50
LCA
<?php
error_reporting(E_ALL ^ E_NOTICE);
function findLCA( $root, $a, $b)
{
// no root no LCA.
if (!$root) {
return null;
}