Skip to content

Instantly share code, notes, and snippets.

@trevorrowe
trevorrowe / gist:7a36332bed24791a1196
Last active August 29, 2015 14:15
Uploading files to Amazon S3 using the AWS SDK for Ruby v2
# You can pass client options directly to the Resource constructor,
# no need to construct a client yourself
s3 = Aws::S3::Resource.new(
credentials: Aws::Credentials.new('akid', 'secret'),
region: 'eu-west-1'
)
s3.bucket('backup').object('dir/subdir/filename.txt').upload_file(local_file)
@aleclarson
aleclarson / ObjectIdentifier.swift
Last active December 9, 2016 01:37
Convenience functions for ObjectIdentifier hashes
/// Generate a unique identifier for an AnyObject.
/// 2nd slowest. Converts to String.
public func obid (object: AnyObject) -> String {
return "\(obid(object) as Int)"
}
/// Generate a unique identifier for an AnyObject.
/// Fastest. Every other function relies on this one.
public func obid (object: AnyObject) -> Int {
@tadast
tadast / ssl_puma.sh
Last active January 29, 2024 04:41 — forked from trcarden/gist:3295935
localhost SSL with puma
# 1) Create your private key (any password will do, we remove it below)
$ cd ~/.ssh
$ openssl genrsa -des3 -out server.orig.key 2048
# 2) Remove the password
$ openssl rsa -in server.orig.key -out server.key
@mtigas
mtigas / 01.md
Last active November 5, 2023 03:45
HTTPS / SSL certificate config stuff

Normal SSL cert

export DATE=`date +"%Y%m"`
export SITENAME="mike_tig_as"
export KEYNAME="$DATE-$SITENAME"

# Generate private key, make it have no password.
# change to 2048 if you want compatibility with CDNs / aws cloudfront / load balancers, etc
openssl genrsa -aes256 -passout pass:xxxx -out "${KEYNAME}.pass.key" 4096
openssl rsa -passin pass:xxxx -in ${KEYNAME}.pass.key -out ${KEYNAME}.key