Skip to content

Instantly share code, notes, and snippets.


Aaron Lifton aaronlifton

View GitHub Profile
aaronlifton / s3_folder_upload.rb
Last active April 17, 2019 21:23 — forked from fleveque/s3_folder_upload.rb
Upload folder to S3 recursively with ruby, multi threads and aws-sdk v2 gem, based on
View s3_folder_upload.rb
#!/usr/bin/env ruby
require 'rubygems'
require 'aws-sdk'
class S3FolderUpload
attr_reader :folder_path, :total_files, :s3_bucket, :include_folder
attr_accessor :files
# Initialize the upload class
aaronlifton / mastodon
Created November 2, 2017 06:38 — forked from skoji/mastodon
Mastodon : execute assets:precompile on a local machine.
View mastodon
# on the mastodon server
cd /home/mastodon/live
git checkout <release tag>
docker-compose pull && docker-compose build && docker-compose stop
# on the local machine
rsync -trzv --delete --rsync-path='sudo rsync' backup # get full backup
cd backup
docker-compose pull && docker-compose build && docker-compose run --rm web rails assets:precompile
cd ..
aaronlifton /
Created September 27, 2017 00:48
describe ec2 instances in all regions
for region in `aws ec2 describe-regions --output text | cut -f3`
echo -e "\nListing Instances in region:'$region'..."
aws ec2 describe-instances --region $region
aaronlifton /
Created September 11, 2017 20:26 — forked from d2s/
Installing Node.js for Ubuntu with nvm
aaronlifton / routes.elm
Created May 30, 2017 19:52 — forked from hallettj/routes.elm
Example of a graph in Elm
View routes.elm
import Html exposing (text)
import List exposing (concatMap, filter)
import List.Extra exposing (uniqueBy)
type alias CityId = Int
type alias City =
{ id: CityId
, name: String
aaronlifton / Enhance.js
Created May 30, 2017 18:08 — forked from sebmarkbage/Enhance.js
Higher-order Components
View Enhance.js
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
componentDidMount() {
this.setState({ data: 'Hello' });
render() {
aaronlifton / optparse-template.rb
Created May 17, 2017 21:00 — forked from rtomayko/optparse-template.rb
Ruby optparse template
View optparse-template.rb
#!/usr/bin/env ruby
#/ Usage: <progname> [options]...
#/ How does this script make my life easier?
# ** Tip: use #/ lines to define the --help usage message.
$stderr.sync = true
require 'optparse'
# default options
flag = false
option = "default value"
aaronlifton / extended_original_payment.rb
Created May 2, 2017 19:48
extending spree original payment reimbursement type
View extended_original_payment.rb
module Spree::ReimbursementType::ExtendedOriginalPayment
def self.included(base)
class << base
include ClassMethods
module ClassMethods
def reimburse(reimbursement, return_items, simulate)
if simulate
aaronlifton / callbacks.rb
Created May 2, 2017 18:41
active support callbacks example
View callbacks.rb
class V
include ActiveSupport::Callbacks
define_callbacks :derp
set_callback :derp, :after, :after_derp
attr_accessor :x
def derp
run_callbacks :derp do
@x = 1
puts @x