Skip to content

Instantly share code, notes, and snippets.

@manur
manur / gist:8944463
Created February 11, 2014 21:22 — forked from mcansky/gist:3434417
# encoding : utf-8
require 'openssl'
require 'digest/sha1'
require 'base64'
module Aws
extend self
def signed_url(path, expire_date)
digest = OpenSSL::Digest::Digest.new('sha1')
can_string = "GET\n\n\n#{expire_date}\n/#{S3_BUCKET}/#{path}"
@manur
manur / gist:4393962
Last active December 10, 2015 06:18 — forked from rawsyntax/gist:789162
##
# Validates a URL
#
# If the URI library can parse the value, and the scheme is valid
# then we assume the url is valid
#
require 'addressable/uri'
require 'net/http'
@manur
manur / periodic_backup.sh
Created January 23, 2012 06:10 — forked from olly/backup.sh
Duplicity Backup Script
#!/bin/bash
# Export some ENV variables so you don't have to type anything
export AWS_ACCESS_KEY_ID=<your-access-key-id>
export AWS_SECRET_ACCESS_KEY=<your-secret-access-key>
export PASSPHRASE=<your-gpg-passphrase>
GPG_KEY=<your-gpg-key>
# The source of your backup, by default the home directory
SOURCE=$HOME
@manur
manur / migrate.rb
Created December 26, 2011 19:13 — forked from cyfdecyf/migrate.rb
Migrate from wordpress to octopress
# coding: utf-8
require 'rubygems'
require 'hpricot'
require 'fileutils'
require 'time'
require 'ya2yaml'
require 'nokogiri'
require 'cgi'