Skip to content

Instantly share code, notes, and snippets.

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+mW+cN+tjx2m1dY+adRhVSI/I7zzInRd4SVEm6S2pWqiJT9X1mICTHwgSdLpvgN5PRpvmwp67rUSDLMqzOPrb3VeJlhjFxmuz0TXbjYyZgGVvX7llR0X32Lu8PWe3HMFPsDA/sVvz7MS/Qk7z/OA1LtZdcVYRXq5gZgfiY0mfIZMWRWDcbAUuHAoOwp54H7prya/jHofpbTFKOazxxLjsKPAzFAXlWiYF3ggjVN0qZ7YzCjVJvjY0ehVP7d+VPsDRrUPeYjlELeE5DC4X2BihG5l6BrAx5QpURXCIbQfazruOTC07CikszxsDEuvOPJ+9IfrckVShOugm8fLGhvFyHpZEKz5IoGpdIof+EXqlYB46mYaq7/PzmuUd+Grr/gxHBMa57/E3ls1wl1FknBBEfFfspkamPoyyT/oWScv3iWUIHWX2DHK5rtm4wtChpjY0zq53/h9clYW2LHrtfOsxsUBwnbsVbMa0x8EzZEuTiq/VzWQE0WXWx9dGXrW7EmpIP+bUV1qvSFT/9AZ+BkCDy5c2P8fVwAS1sarJr1xzmAB3xhsDK6vMXwSsben2hQGZ3GbZzlHsCIDRIoKXbh6mLkhSU91KTMkJyqn8CDO3nqzNnsRsRyuTlqaCiYLm3OQ0FRFDmDFkbRCuK7B6j6v6otM0n0h4K87YfpVbBFJ3oQ== [email protected]

Keybase proof

I hereby claim:

  • I am rafops on github.
  • I am rafops (https://keybase.io/rafops) on keybase.
  • I have a public key ASBN_mHPRK9aZFJZLNE8g-vu2_STFaG5JDf7pTf8AXNqiQo

To claim this, I am signing this object:

@rafops
rafops / letsencrypt-cloudfront.md
Created January 24, 2017 17:11
Let's Encrypt and CloudFront

Let's Encrypt

Install certbot:

brew install certbot

Generate certificate:

def uuid_to_urlsafe_base64(uuid)
s = [[uuid.delete('-')].pack('H*')].pack('m')
s.delete!("\n")
s.tr!('+/', '-_')
s.delete!('=')
s
end
uuid_to_urlsafe_base64(SecureRandom.uuid)
# This file stub imagemagick calls on paperclip
class Paperclip::StubQueue
cattr_accessor :q
@@q=[]
end
module Paperclip
def self.run cmd, arguments = "", interpolation_values = {}, local_options = {}
case cmd
RSpec::Matchers.define :match_response_schema do |schema,fragment|
match do |response|
puts ""
print "Method:\t\t".magenta
puts request.method.purple
print "Path:\t\t".magenta
puts request.path.purple
print "Request:\t".magenta
puts request.params.select { |p| !['controller', 'action'].include? p }.to_s.purple
require 'nokogiri'
require 'uri'
require 'resolv'
raw = <<-EOS
<p><span class="KonaFilter image-container display-table float_right"><span><span data-post-image="" class="image on-image"><img src="http://static3.businessinsider.com/image/56b3c07b6e97c621048b4fbe-975-731/4278432941_5cb085182e_b.jpg" alt="linkedin chocolates" data-mce-source="Nan Palmero/Flickr" data-link="https://www.flickr.com/photos/nanpalmero/4278432941/in/photolist-7w564c-9fLRVv-7yuDWB-n5ztS-d59ToJ-5BwY81-82Buin-82EzHN-cNL4r7-82EAmu-cNL2KS-5R4hW5-9MKoLL-adWYuV-spAUPG-ayeJFw-yb7CFx-dyyYT5-y1k6uo-8W2L2-aFbk4G-dTZsva-9v76Un-sG1A7b-dwtTSy-9Y9nGA-eqJboT-zX9Xu-7xatis-AV3XRq-axKupX-gjuvyS-8Q7Mti-ahEZH8-82EA7f-s98dqU-8QaSYo-arq76A-aEVD3h-7RD8PQ-dQuDXo-ayc3yD-e2G9qu-dQp4Xr-6tLekM-n2HCV-beKTxv-rPWtoe-dq4wxW-cXgNKw"><span class="source"><span><a href="https://www.flickr.com/photos/nanpalmero/4278432941/in/photolist-7w564c-9fLRVv-7yuDWB-n5ztS-d59ToJ-5BwY81-82Buin-82EzHN-cNL4r7-82EAmu-cNL2KS-5R4hW5-9MKoLL-adWYuV-spAUPG-ayeJFw-yb7CFx-dyyYT5-y1k6uo-8W2L
@rafops
rafops / git_worked_hours.rb
Created December 5, 2015 15:07
Display worked hours statistics based on git log
#!/usr/bin/ruby
require 'date'
author="[email protected]"
period=(ARGV[0].to_i) || 30 # days
after = (DateTime.now - period).strftime('%Y-%m-%d')
log = %x{git log --all --author=#{author} --after=#{after} --date=iso-strict --pretty='%H|%cd'}
package main
import (
"fmt"
"math"
"runtime"
)
const Pi = 3.1415
diff --git a/index.php b/index.php
index 882b597..213ef3c 100644
--- a/index.php
+++ b/index.php
@@ -1 +1,5 @@
-<?php echo phpinfo();
+<?php
+
+include "./lib/mylib.php";
+