Skip to content

Instantly share code, notes, and snippets.

{
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:PutObject",
"s3:GetObjectAcl",
"s3:PutObjectAcl",
"s3:ListBucket",
@robjshaw
robjshaw / gist:845bbee579aa09db666d
Last active August 29, 2015 14:02
simple backup script for webroot -> s3 backup
#!/bin/bash
NOW=$(date +"%m-%d-%Y")
file="$NOW.appname.tar.gz"
sourcedir='/var/www/appname/public_html'
bucketname="s3://bucketname/$file"
echo "backing up $sourcedir to /tmp/$file & then to s3 bucket $bucketname"
tar -zcvf /tmp/$file $sourcedir
echo 'all backed up now s3 move'
// aws cloudformation describe-stacks --region ap-southeast-2 | jq '.Stacks[] | select( .Parameters[0].ParameterValue == "s3://" ) | { StackId }'
{
"StackId": "arn:aws:cloudformation:ap-southeast-2:xxxxxxx",
"Description": "Cache Cluster",
"Parameters": [
{
"ParameterValue": "SecurityGroupWebCacheCluster",
"ParameterKey": "SecurityGroup"
},
@robjshaw
robjshaw / gist:30db8ebc9ddc8daf3d07
Last active August 29, 2015 14:10
setting up hackfest box
# ubuntu 14.10 server
sudo apt-get update
#sudo apt-get install node
#sudo apt-get install nodejs
#sudo apt-get install npm
# set up rest http://www.getrailo.org/index.cfm/whats-up/railo-40-beta-released/features/rest-services/
# set up ngrok on mac https://www.twilio.com/blog/2013/10/test-your-webhooks-locally-with-ngrok.html
wget -r -nc --user="username" --password="password" ftp://server/folder/folder
@robjshaw
robjshaw / batch-spilt
Created November 12, 2015 00:27
playing around with large files
<cfscript>
queue = createobject('component', 'ecgateway.owi.business.services.queue');
folderName = createUUID();
</cfscript>
<cfdirectory action="create" directory="/tmp/#folderName#" mode="777">
<cffile action="copy" source="/tmp/msns_50k.txt" destination="/tmp/#folderName#/" />
<cfexecute name="split" arguments="-l 500 /tmp/#folderName#/msns_50k.txt /tmp/#folderName#/" />
@robjshaw
robjshaw / gist:4980676
Last active December 13, 2015 21:58 — forked from davidsirr/gist:4976499
# get homebrew http://mxcl.github.com/homebrew/
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
# use homebrew to install rbenv and ruby-build
brew update
brew install rbenv
brew install ruby-build
# view available rubies
rbenv install --list
# create rails app - option allows you to write test suite in rspec instead of default
rails new demo_app --skip-test-unit
# production only gems located in gemfile (pg = postgres)
group :production do
gem 'pg', '0.12.2'
end
# dev and test env
group :development, :test do
@robjshaw
robjshaw / gist:5017372
Last active December 14, 2015 02:59
git basic
# create ssh key https://help.github.com/articles/generating-ssh-keys
# create repo https://github.com/new
git init
git add .
git commit -m "Initial commit"
git mv README.rdoc README.md
git commit -a -m "Improve the README"
#gem file config
group :development, :test do
gem 'sqlite3', '1.3.5'
gem 'rspec-rails', '2.11.0'
gem 'guard-rspec', '1.2.1'
end
group :test do
gem 'capybara', '1.1.2'