Skip to content

Instantly share code, notes, and snippets.

View mattetti's full-sized avatar

Matt Aimonetti mattetti

View GitHub Profile
$ ROLE=$(curl http://169.254.169.254/latest/meta-data/iam/security-credentials/)
$ curl http://169.254.169.254/latest/meta-data/iam/security-credentials/$ROLE
@fujin
fujin / gist:6094233
Last active December 20, 2015 07:38
thoughtworks go-server / go-agent powered with @dot_cloud Docker
ubuntu@continubus:~/dockerfiles/go-agent$ docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
d89f44c4df5b fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
a132f54a0442 fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
da8b513fbb2a fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
c100df11f9d7 fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
929adf4cbc3b fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
79720ed86e0b fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
ca9403fe93e2 fujin/go-agent:latest /b
package backup_downloader
import (
"bytes"
"io"
"log"
"os"
"os/exec"
"sync"
)
@macournoyer
macournoyer / Dockerfile
Last active December 14, 2019 16:31
Playing w/ Dockerfile on OS X
FROM base
MAINTAINER Marc-Andre Cournoyer "macournoyer@gmail.com"
RUN apt-get -y update
RUN apt-get install -y -q curl
RUN curl -L https://get.rvm.io | bash -s stable --ruby
RUN /bin/bash -l -c rvm requirements
@teeparham
teeparham / dev.log
Created March 6, 2013 08:05
rails 3.2.12 + ruby 2.0 + bare project + tracepoint
=> Booting WEBrick
=> Rails 3.2.12 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-03-06 01:02:27] INFO WEBrick 1.3.1
[2013-03-06 01:02:27] INFO ruby 2.0.0 (2013-02-24) [x86_64-darwin11.4.2]
--- 1
/monkeys/index
require "raindrops"
class UnicornConnectionMonitor
def initialize(app, options = {})
@app = app
@statsd = options.fetch(:statsd)
end
def call(env)
if linux? && unicorn?
@mislav
mislav / OpenSSL fix.md
Last active June 8, 2023 07:48
Fix OpenSSL certificate errors on Ruby 2.0

The reason why you might get certificate errors in Ruby 2.0 when talking HTTPS is because there isn't a default certificate bundle that OpenSSL (which was used when building Ruby) trusts.

Update: this problem is solved in edge versions of rbenv and RVM.

$ ruby -rnet/https -e "Net::HTTP.get URI('https://github.com')"
net/http.rb:917:in `connect': SSL_connect returned=1 errno=0 state=SSLv3
  read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

You can work around the issue by installing a certificate bundle that you trust. I trust Mozilla and curl.

@mislav
mislav / fat-logfiles.sh
Last active December 22, 2018 19:56
Find "*.log" files in your home dir, sort them by fattest-first, and calculate the size of them all together.
find ~ -name '*.log' -print0 | xargs -0 -L1 stat -f'%z %N' | sort -rn | tee fat-logfiles.txt | head
awk '{ total += $1 } END { printf "total: %5.2f MiB\n", total/1024/1024 }' < fat-logfiles.txt
@jeffyip
jeffyip / rails_json_cookie_session_store.rb
Last active September 23, 2020 07:03
Monkey Patch Ruby on Rails' cookie based session store to use JSON as its serializer instead of Marshal
@mattetti
mattetti / 0-readme.md
Created October 11, 2012 18:23 — forked from burke/0-readme.md

Ruby 1.9.3-p194 with DTrace probes, Perf Patches, and backported COW-friendly GC

Overview

This script installs a patched version of ruby 1.9.3-p194 with DTrace probes, boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Many thanks to funny-falcon for the performance patches and to Aaron Patterson for the DTrace instrumentation.