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
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
# 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) |
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
/// 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 { |
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
# 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 |