Skip to content

Instantly share code, notes, and snippets.

View dlackty's full-sized avatar
😇

Richard Lee dlackty

😇
View GitHub Profile
@dlackty
dlackty / aws-sdk.rb
Created October 3, 2016 18:21
Fixing for AWS SDK for Ruby under multi-threading environment
# config/initializers/aws-sdk.rb
require "aws-sdk"
# Threading in modern rails means the AWS autoloading can lead to partially
# loaded namespaces unless we eager load up front. But only do it when we're
# eager loading generally (in production).
Rails.application.config.before_eager_load do
Aws.eager_autoload!
end
@dlackty
dlackty / cloudfront.rb
Created July 28, 2016 16:24
ActionDispatch::RemoteIp trusted proxies for CloudFront
trusted_proxies = ["52.84.0.0/15",
"54.182.0.0/16",
"54.192.0.0/16",
"54.230.0.0/16",
"54.239.128.0/18",
"54.239.192.0/19",
"54.240.128.0/18",
"204.246.164.0/22",
"204.246.168.0/22",
"204.246.174.0/23",

Keybase proof

I hereby claim:

  • I am dlackty on github.
  • I am dlackty (https://keybase.io/dlackty) on keybase.
  • I have a public key whose fingerprint is 8596 0733 47FC D9A6 8F3A 7388 9A21 FD8D 5C03 84FD

To claim this, I am signing this object:

FR24 to gpx

  1. Go to Flightradar24 flights database and find your flight
  2. Get URL like this: http://www.flightradar24.com/data/flights/UA853/#38ae207
  3. ./fr24togpx.rb 38ae207 > FILENAME.gpx
  4. Check you output file using GPS Visualizer
@dlackty
dlackty / ngrok.rb
Last active December 22, 2015 05:09
Homebrew formula for ngrok
require 'formula'
class Ngrok < Formula
homepage 'https://ngrok.com/'
url 'https://dl.ngrok.com/darwin_amd64/ngrok.zip'
sha1 '3c34a7d2b44226ab99b9b51fadc7808db7ace8ff'
version '1.6'
def install
bin.install 'ngrok'
@dlackty
dlackty / config.ru
Created April 16, 2013 11:05
HTTP simple redirection as heroku app.
# This example allows requests for example.com and localhost.
# If any other domain is requested it redirects to the first domain on the
# list - example.com preserving path and query string from the first request.
require "rack/domain_redirect"
# This is how you use and configure Rack::DomainRedirect middleware
use Rack::DomainRedirect, ['icook.tw']
run lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['Hello World!']] }
@dlackty
dlackty / gist:5320376
Created April 5, 2013 15:50
Flipboard mobile redirection.
<iframe id="appLoader" style="display:none;"></iframe>
<script>
var flipboardURL = 'flipboard://showSection/flipboard%2Fsingleurl%252Fhttp%253A%252F%252Fwww.wired.com%252Fmagazine%252F2013%252F04%252Ffacebookqa?resetStack=true&referrer=facebook&createDevice=api&canAddToFlipboard=false&createAction=shareWithComment&showPreselectedItem=true';
var appStoreURL = "http://ax.itunes.apple.com/us/app/flipboard/id358801284?mt=8";
var googlePlayURL = "https://play.google.com/store/apps/details?id=flipboard.app&feature=nav_result#?t=W251bGwsMSwyLDNd";
// try and launch Flipboard with the add section url
if(navigator.userAgent.match(/android/i) != null){
document.getElementById("appLoader").setAttribute("src", flipboardURL);
}
@dlackty
dlackty / oclint.rb
Created February 7, 2013 09:57
Homebrew formula for OCLint 0.6.
require 'formula'
class Oclint < Formula
homepage 'http://oclint.org'
url 'http://archives.oclint.org/releases/0.6/oclint-0.6-x86_64-apple-darwin12.tar.gz'
version '0.6'
sha1 '9fb4bdfb6dbce14986d863d8b672870c0ae08ec8'
depends_on 'llvm'
@dlackty
dlackty / speakerdeckexpander.js
Created December 26, 2012 04:11
Propane caveatPatchor.js snippet to embed SpeakerDeck slide inline.
Campfire.SpeakerDeckExpander = Class.create({
initialize: function(chat) {
this.chat = chat;
var messages = this.chat.transcript.messages;
for (var i = 0; i < messages.length; i++) {
this.detectSpeakerDeckURL(messages[i]);
}
},
detectSpeakerDeckURL: function(message) {