Skip to content

Instantly share code, notes, and snippets.

View rjsamson's full-sized avatar

Robert J Samson rjsamson

View GitHub Profile
@rjsamson
rjsamson / nginx.conf
Last active August 10, 2016 16:04
stackfooter nginx conf
events {
worker_connections 1024;
}
http {
include /etc/nginx/sites-enabled/*;
}
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
"strconv"
@rjsamson
rjsamson / CloudWatch_Alarms_for_CloudTrail_API_Activity.json
Created July 16, 2015 16:12
CloudWatch Alarms for CloudTrail API Activity (CloudFormation Template)
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "AWS CloudTrail API Activity Alarm Template for CloudWatch Logs",
"Parameters" : {
"LogGroupName" : {
"Type" : "String",
"Default" : "CloudTrail/DefaultLogGroup",
"Description" : "Enter CloudWatch Logs log group name. Default is CloudTrail/DefaultLogGroup"
},
"Email" : {
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/ec2"
)
func main() {
@rjsamson
rjsamson / RealmResultsHelpers.swift
Last active August 29, 2015 14:18
Extension for RLMResults to provide take(limit: Int) and toArray()
import Realm
extension RLMResults {
func take (limit: Int) -> [RLMObject] {
var array = [RLMObject]()
let indices: UInt = limit < Int(self.count) ? UInt(limit) - 1 : self.count - 1
for index in 0...indices {
array.append(self[index] as RLMObject)

Keybase proof

I hereby claim:

  • I am rjsamson on github.
  • I am rjs (https://keybase.io/rjs) on keybase.
  • I have a public key whose fingerprint is B1FC CB7B 03E4 CF72 3329 82F2 FB0D 66B6 B800 4318

To claim this, I am signing this object:

@rjsamson
rjsamson / Gemfile
Created October 29, 2013 15:56
Todo App Gemfile and Rakefile
source "https://rubygems.org"
ruby "2.0.0"
gem "ProMotion", "~> 1.0.4"
gem "teacup"
gem 'formotion'
gem 'motion_data_wrapper'
gem "sugarcube", :require => 'sugarcube-all'
@rjsamson
rjsamson / Rakefile
Created May 27, 2013 01:50
Example Rubymotion menubar app
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/osx'
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'MenubarApp'
app.info_plist['NSUIElement'] = 1
end
Bringing machine 'default' up with 'digital_ocean' provider...
[default] Creating the droplet ...
[default] Waiting for the droplet to become active (>= 1 min) ...
[default] Making alterations to the sudoers file where necessary ...
[default] Creating user 'vagrant' and setting password ...
[default] Enabling sudo for user 'vagrant' ...
[default] Adding public key to authorized_keys ...
[default] Installing provisioner: chef-solo (>= 2 min) ...
[default] Droplet IP: 198.211.XXX.XXX ...
[default] Host IP: 192.168.1.10 ...
/lib/vagrant-digitalocean/actions/create.rb:98:in `terminate': uninitialized constant VagrantPlugins::DigitalOcean::Actions::Create::ActionDispatch (NameError)
from /Users/rjsamson/.vagrant.d/gems/gems/vagrant-digitalocean-0.0.4/lib/vagrant-digitalocean/actions/create.rb:89:in `recover'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.0/lib/vagrant/action/warden.rb:66:in `block in recover'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.0/lib/vagrant/action/warden.rb:63:in `each'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.0/lib/vagrant/action/warden.rb:63:in `recover'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.0/lib/vagrant/action/warden.rb:52:in `rescue in call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.0/lib/vagrant/action/warden.rb:28:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.0/lib/vagrant/action/builder.rb:109:in `call'
from /Applications/Vagrant/embedded/gems/gems/vagrant-1.1.0/lib/vagrant/action/runner.rb