Skip to content

Instantly share code, notes, and snippets.

View jipiboily's full-sized avatar

JP Boily jipiboily

  • Alma, Quebec, Canada
View GitHub Profile
@mperham
mperham / gist:5f492a2233ed44d1bb2b
Last active April 16, 2024 12:31
Golang high-level crypto APIs

Go has a number of low-level crypto APIs which check off marketing bullet-points (got FIPS supprt, check!) but is missing an high-level API usable by mere mortal programmers. Imagine you want to create a document, sign it and verify that document later. Now check out Go's crypto APIs and give up in frustration after an hour of Googling.

The API should encapsulate a half-dozen common operations and make them as easy as possible. Avoid choice where possible, just pick something reasonably secure in 2014 for me and use it! I'm speaking specifically of a few basic actions (yes, this API is very naive/non-idiomatic), call it crypto/easy:

  • Create me a public/private key pair and save it to the filesystem.
// create and persist a keypair to the current directory.
// this is just a one-time operation, now we have a keypair to use.
easy.CreateKeyPair()
@Supro
Supro / active_model_serializers_rspec.rb
Last active December 26, 2015 11:09
ActiveModelSerializers example
### spec/serializers/building_spec.rb
require "spec_helper"
describe BuildingSerializer do
include Rails.application.routes.url_helpers
let(:room) { create :room }
let(:building) { room.building }
let(:hash) { BuildingSerializer.new(building).serializable_hash }
@wsargent
wsargent / docker_cheat.md
Last active June 29, 2024 19:32
Docker cheat sheet
@petehamilton
petehamilton / README.md
Last active July 8, 2021 09:50
Circle CI Build Status widget for Dashing (Single Builds)

Description

Dashing widget to show the build status of a CircleCI project.

Usage

  • Get a Circle API Token from your Account Dashboard and set it in your environment as CIRCLE_CI_AUTH_TOKEN
  • Add the httparty to your Gemfile and run bundle install

Then:

#!/bin/bash
git checkout master
git pull
git branch --remotes --merged | grep origin > .master_merged
git checkout release-staging
git pull
git branch --remotes --merged | grep origin > .staging_merged
diff .master_merged .staging_merged
rm .master_merged .staging_merged
@remi
remi / example.rb
Created December 6, 2012 18:38
Gathering options using a block
# config/initializers/tumbz_init.rb
Tumbz.configure do |config|
config.access_key = "foo"
config.access_secret = "bar"
end
# lib/tumbz.rb
module Tumbz
def self.configure
@options = OpenStruct.new
@hinke
hinke / gist:3823496
Created October 2, 2012 21:43
Fetch headers from build image and do something
get '/travis/:id/status' do |id|
token = "token!!"
http = Net::HTTP.new('magnum.travis-ci.com', 443)
http.use_ssl = true
path = "/Readmill/#{id}.png?token=#{token}"
response = http.head(path, nil)
if response['Content-Disposition'].include?('failing')
@message = "The build failed."
@groveriffic
groveriffic / mathlink.rb
Created August 31, 2012 03:33
jruby-mathlink
git rev-parse HEAD | tr -d '\n' | pbcopy
@jipiboily
jipiboily / _actions.html.erb
Created April 8, 2012 18:12
How to setup a Refinery custom content type and view (aka "page template")
<!-- path: app/views/refinery/admin/pages/_actions.html.erb -->
<!--
You could override this view, if you want to add links to each page type via the admin UI. If you don't you'll have to add a param the the URL.
WARNING: You most probably want to do it cleaner than that and find a way to hook to this view instead of overriding it if at all possible.
-->
<ul>
<li>
<%= render '/refinery/admin/search', :url => refinery.admin_pages_path %>
</li>