Skip to content

Instantly share code, notes, and snippets.

def momo(a, b)
a+b
end
container = WAZ::Blobs::Container.find('copy-test')
container.nil?.should == false
container.store('blob', 'payload', 'plain/text')
container.public_access = true
container.public_access?.should == true
blob = container['blob']
blob.nil?.should == false
@johnnyhalife
johnnyhalife / app.rb
Created February 20, 2010 15:20
Rack::Auth::WRAP protected resource sample
require 'rubygems'
require 'sinatra'
require 'rack/auth/wrap'
use Rack::Auth::WRAP, :shared_secret => "NjkzNTczOTAtMDA2MC0wMTJkLTQ1M2YtMDAyMzMyYjFmYWY4\n",
:audiences => "http://localhost:4567",
:trusted_issuers => "urn:demo-issuer"
get "/" do
if @env["REMOTE_USER"]
@johnnyhalife
johnnyhalife / client.rb
Created February 20, 2010 15:40
Rack::Auth::WRAP protected resource client
require 'rubygems'
require 'cgi'
require 'base64'
require 'restclient'
require 'hmac/sha2'
SHARED_SECRET = "NjkzNTczOTAtMDA2MC0wMTJkLTQ1M2YtMDAyMzMyYjFmYWY4\n"
simple_web_token = {'Audience' => "http://localhost:4567",
'Issuer' => "urn:demo-issuer",
@johnnyhalife
johnnyhalife / gist:354130
Created April 3, 2010 04:58
rename-series
function capitalize {
$result = ""
$args[0].trim().split(" ") | %{ ($_.trim()[0].toString().toUpper()) + $_.substring(1)} | %{ $result += $_ + " "}
return $result.trim()
}
function namify {
$currentName = $args[0].name -replace [regex]"(wWw.*|notv|hdtv.*).avi", [String]::Empty
$segments = ([regex]"(.*).[s|S](\d+)[e|E](\d+).*").matches($currentName)
ls | %{ mv $_.FullName ([regex]::replace($_.Name, "(.*).(\d)(\d{2}).avi", '$1.s0$2e$3.avi')) }
# Adds a new host entry on the hosts file as shown:
#
# add-host www.southworks.net 127.0.0.1 [optional $true|$false]
#
# the third parameter indicates whether if exists it should be overwritten
function add-host {
# map parameters
$hostname, $address, $override = $args[0], $args[1], ($args[2] -eq $true)
# generte some basics
$INTIAL_SPACE = 5
# On the hosts file use the same spa cing between entries using
# 7 as the constant spaces between "words" but compensating length
function tabulate {
$longest, $source = 1, $args[0]
$contents = (gc $source)
#find the longest word
clear-content $source
public static class AzureTableStringHelpers
{
public static string AsEncodedKey(this string key)
{
if (key == null)
{
return null;
}
return Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(key));
#!/bin/sh
# Fetch and install the latest Chromium mac nightly build, but only
# if it's different from the currently installed version. An existing
# Chromium.app is backed up to .Chromium.app in the same directory.
#
# Install with:
# $ curl -L http://bit.ly/night-chrome > ~/bin/nightly-chromium
# $ chmod +x ~/bin/nightly-chromium
#
# To upgrade to latest chromium version: