Skip to content

Instantly share code, notes, and snippets.

View matiaskorhonen's full-sized avatar

Matias Korhonen matiaskorhonen

View GitHub Profile
@matiaskorhonen
matiaskorhonen / letsencrypt-cf-updater.rb
Created February 23, 2016 08:44
A short Ruby script to push a Let's Encrypt certificate to AWS Cloudfront (via IAM). Also configures the distribution to use the newly uploaded certificate.
#!/usr/bin/env ruby
require "aws-sdk" # Ruby AWS SDK '~> 2'
cloudfront = Aws::CloudFront::Client.new
iam = Aws::IAM::Client.new
distribution_id = "..." # Add your Cloudfront distribution ID here
certificate_base_name = "..." # A prefix for the certificate name on CF
@matiaskorhonen
matiaskorhonen / check-certificate.rb
Last active June 12, 2025 07:13
Check an SSL/TLS certificate in Ruby (with SNI support)
# Modified from:
# http://findingscience.com/ruby/ssl/2013/01/13/reading-an-ssl-cert-in-ruby.html
require "socket"
require "openssl"
host = "www.piranhas.co"
tcp_client = TCPSocket.new("www.piranhas.co", 443)
ssl_client = OpenSSL::SSL::SSLSocket.new(tcp_client)
@matiaskorhonen
matiaskorhonen / toggle-tv-power off.sh
Created January 28, 2016 16:04
A quick script to control the power state of a TV attached to a Raspberry Pi over HDMI. Requires `cec-utils` to be installed.
#!/usr/bin/env bash
iso8601_date () {
date +%Y-%m-%dT%H:%M:%S%z
}
turn_on () {
echo 'on 0' | cec-client -s -d 1 RPI
}
@matiaskorhonen
matiaskorhonen / toggle-tv-power off.sh
Created January 28, 2016 16:04
A quick script to control the power state of a TV attached to a Raspberry Pi over HDMI.
#!/usr/bin/env bash
iso8601_date () {
date +%Y-%m-%dT%H:%M:%S%z
}
turn_on () {
echo 'on 0' | cec-client -s -d 1 RPI
}
@matiaskorhonen
matiaskorhonen / hollow-gophers.rb
Created January 25, 2016 19:42
Quick and dirty script to find empty and otherwise suspect repos
require "json"
require "octokit"
json = '["https://github.com/gophergala2016/webrtc-tab-share","https://github.com/gophergala2016/addit","https://github.com/gophergala2016/smart_app","https://github.com/gophergala2016/netsailor","https://github.com/gophergala2016/kong","https://github.com/gophergala2016/Batit-Project","https://github.com/gophergala2016/Go-Serve","https://github.com/gophergala2016/Festival","https://github.com/gophergala2016/fireup","https://github.com/gophergala2016/globegala","https://github.com/gophergala2016/gHorcrux","https://github.com/gophergala2016/papercast","https://github.com/gophergala2016/openlandings","https://github.com/gophergala2016/gopherlay","https://github.com/gophergala2016/standup-bot","https://github.com/gophergala2016/gongeries","https://github.com/gophergala2016/wwcdc_01","https://github.com/gophergala2016/syamp","https://github.com/gophergala2016/AngryGophers","https://github.com/gophergala2016/klaster","https://github.com/gophergala2016/didactic-octo-chainsaw","http
@matiaskorhonen
matiaskorhonen / gist:2fb4b024acefd522d5bc
Created May 27, 2015 15:38
pkill autocomplete error
~ » pkill ps: illegal argument: co 2 ↵
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
[-g grp[,grp...]] [-u [uid,uid...]]
[-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
ps [-L]
ps: illegal argument: co
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
[-g grp[,grp...]] [-u [uid,uid...]]
[-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
ps [-L]
@matiaskorhonen
matiaskorhonen / app.js
Created December 10, 2014 13:54
iOS 7 position: fixed bug workaround
$(function () {
$(document).on('open.fndtn.reveal', '[data-reveal]', function () {
$modal = $(this);
$modal.find(".row").addClass("iosfix");
});
$(document).on('opened.fndtn.reveal', '[data-reveal]', function () {
$modal = $(this);
setTimeout(function() {
$modal.find(".row").removeClass("iosfix")
@matiaskorhonen
matiaskorhonen / test.md
Created December 2, 2014 13:43
Testing

GitHub Markup

We use this library on GitHub when rendering your README or any other rich text file. The generated HTML is then run through filters in the html-pipeline to perform things like sanitization and syntax highlighting.

Markups

The following markups are supported. The dependencies listed are required if

module ApplicationHelper
def svg_image_tag(image_name, options={})
svg_name = image_name.gsub(/#{Regexp.escape File.extname(image_name)}\z/, ".svg")
options[:onerror] = "this.onerror=null; this.src='#{asset_path(svg_name)}'"
image_tag(image_name, options)
end
end
@matiaskorhonen
matiaskorhonen / rails-osx.md
Last active August 29, 2015 14:08
Basic Rails set-up for OS X
  1. Install XCode (from the app store)

  2. Run:

xcode-select --install
  1. Install Oh My ZSH: http://ohmyz.sh/