Skip to content

Instantly share code, notes, and snippets.

View lmars's full-sized avatar

Lewis Marshall lmars

View GitHub Profile
@lmars
lmars / scheduler.log
Created June 2, 2014 15:27
Flynn Scheduler Restarts
# flynn scale web=2
now=2014-06-02T15:14:46+0000 app=controller-scheduler fn=watchFormations app.id=6f98d85441b94de0bf003a40882db52a release.id=7afc7da66395445fa7a8372cdb915001 at=new
now=2014-06-02T15:14:46+0000 fn=rectify app.id=6f98d85441b94de0bf003a40882db52a release.id=7afc7da66395445fa7a8372cdb915001 type=web expected=2 actual=0 app=controller-scheduler at=update diff=2
now=2014-06-02T15:14:46+0000 app=controller-scheduler fn=add app.id=6f98d85441b94de0bf003a40882db52a release.id=7afc7da66395445fa7a8372cdb915001 host.id=00687624bf25 job.id=032bb075d20a44eb8108117be085b5cb
now=2014-06-02T15:14:46+0000 app=controller-scheduler fn=add app.id=6f98d85441b94de0bf003a40882db52a release.id=7afc7da66395445fa7a8372cdb915001 host.id=00687624bf25 job.id=75197216462545ed9d5cb0d84081fe12
# docker kill flynn-032bb075d20a44eb8108117be085b5cb
# job restarted immediately
now=2014-06-02T15:15:32+0000 app=controller-scheduler fn=watchHost host.id=00687624bf25 at=remove job.id=032bb075d20a44eb8108117be085b5cb event=stop
no
@lmars
lmars / keybase.md
Created April 30, 2014 01:20
keybase.md

Keybase proof

I hereby claim:

  • I am lmars on github.
  • I am lmars (https://keybase.io/lmars) on keybase.
  • I have a public key whose fingerprint is 6BFE 8AC3 30EA B9F9 317D 5837 9E4F E42F D94C 0795

To claim this, I am signing this object:

@lmars
lmars / ssl.rb
Created April 23, 2014 16:08
Strowger SSL
require "socket"
require "openssl"
puts OpenSSL::OPENSSL_VERSION
socket = TCPSocket.new("127.0.0.1", 8081)
ssl_version = ARGV[0].to_sym
ssl_context = OpenSSL::SSL::SSLContext.new
@lmars
lmars / config-exec.rb
Created March 2, 2014 20:27
config-exec
#!/usr/local/bin/ruby
#
# config-exec will render any files in /config and then exec
# whatever command was given on the command line.
#
# For example, if /config/etc/redis.conf.erb exists, then to
# render it into /etc/redis.conf and run Redis with the result:
#
# $ config-exec redis-server /etc/redis.conf
@lmars
lmars / Dockerfile
Created February 20, 2014 16:12
dicoverd Dockerfile
FROM ubuntu:precise
# Set DEBIAN_FRONTEND to non-interactive to avoid useless warnings
ENV DEBIAN_FRONTEND noninteractive
# Update apt sources
RUN apt-get update
# Support adding PPAs
RUN apt-get install -y python-software-properties
@lmars
lmars / deployer.rb
Last active August 29, 2015 13:55
Docker Deployer
class Deployer
attr_accessor :current_id
attr_reader :image
def initalize(image)
@image = image
end
def start
self.current_id = run "docker run #{image}"
@lmars
lmars / Gemfile
Last active December 30, 2015 14:39
Async rack app to fetch giphy gifs
source "https://rubygems.org"
gem "em-http-request"
gem "eventmachine"
gem "json"
gem "rack"
gem "thin"
@lmars
lmars / dump.rb
Last active December 29, 2015 10:19
Dump top ten Ruby objects by count every minute
Thread.start do
loop do
objects = Hash.new(0)
ObjectSpace.each_object { |obj| objects[obj.class] += 1 }
File.open("/tmp/top_ten_objects.txt", "a") do |file|
file.puts "-" * 50
file.puts "PID: #{Process.pid} - #{Time.now.strftime("%c")}"
file.puts "-" * 50
@lmars
lmars / resque.rake
Created November 5, 2013 13:39
Resque setup
namespace :resque do
task :setup do
ENV["MY_CUSTOM_KEY"] = "MY CUSTOM VALUE"
end
end
@lmars
lmars / 00_sync.rb
Last active December 18, 2015 10:29
require 'net/http'
require 'uri'
random_url = URI('http://www.random.org/integers/?num=1&min=1&max=6&col=1&base=10&format=plain&rnd=new')
ints = []
resp = Ne