Skip to content

Instantly share code, notes, and snippets.

View stefanozanella's full-sized avatar

Stefano Zanella stefanozanella

View GitHub Profile
@mitfik
mitfik / ruby_csr_example.rb
Created February 27, 2012 10:13
Ruby example of CSR with openssl
require 'openssl'
def gen_key(name)
key = OpenSSL::PKey::RSA.new 1048
file = File.new(name, "w")
file.write(key)
file.close
end
def get_key(name)
@retr0h
retr0h / gist:2003252
Created March 8, 2012 20:29
nova ssl offloading
server {
listen 443 default_server ssl;
server_name api.example.com;
ssl_certificate /path/to.crt;
ssl_certificate_key /path/to.key;
access_log /var/log/nginx/example.com-ssl.log;
location / {
include /etc/nginx/proxy.conf;
proxy_pass http://localhost: 8774/;
}
@ordinaryzelig
ordinaryzelig / minitest_spec_expectations.md
Last active December 10, 2022 13:34
How to write MiniTest::Spec expectations

I'm a fan of MiniTest::Spec. It strikes a nice balance between the simplicity of TestUnit and the readable syntax of RSpec. When I first switched from RSpec to MiniTest::Spec, one thing I was worried I would miss was the ability to add matchers. (A note in terminology: "matchers" in MiniTest::Spec refer to something completely different than "matchers" in RSpec. I won't get into it, but from now on, let's use the proper term: "expectations").

Understanding MiniTest::Expectations

Let's take a look in the code (I'm specifically referring to the gem, not the standard library that's built into Ruby 1.9):

# minitest/spec.rb

module MiniTest::Expectations
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@steveklabnik
steveklabnik / test.txt
Created April 25, 2013 19:55
Lots of gems throw warnings!
$ rake test
/opt/rubies/2.0.0-p0/bin/ruby -I"lib:test" -w -I"/Users/steve/.gem/ruby/2.0.0/gems/rake-10.0.4/lib" "/Users/steve/.gem/ruby/2.0.0/gems/rake-10.0.4/lib/rake/rake_test_loader.rb" "test/map_stream_test.rb" "test/map_test.rb" "test/merge_test.rb" "test/mvp_test.rb" "test/on_value_test.rb" "test/select_test.rb"
/Users/steve/.gem/ruby/2.0.0/gems/simplecov-html-0.7.1/lib/simplecov-html.rb:57: warning: assigned but unused variable - title_id
/Users/steve/.gem/ruby/2.0.0/gems/coveralls-0.6.7/lib/coveralls.rb:66: warning: `&' interpreted as argument prefix
/Users/steve/.gem/ruby/2.0.0/gems/coveralls-0.6.7/lib/coveralls.rb:72: warning: `&' interpreted as argument prefix
/Users/steve/.gem/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/exceptions.rb:157: warning: assigned but unused variable - message
/Users/steve/.gem/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/exceptions.rb:167: warning: assigned but unused variable - message
/Users/steve/.gem/ruby/2.0.0/gems/rest-client-1.6.7/lib/restclient/response.
@jbenet
jbenet / simple-git-branching-model.md
Last active April 9, 2024 03:31
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

The Network The Next Frontier for Devops http://www.slideshare.net/botchagalupe/sdn-and-devops

Cumulus Networks: A Sneak Preview of One of My Favorite Startups - James Hamilton Blog http://perspectives.mvdirona.com/2013/06/18/CumulusNetworksASneakPreviewOfOneOfMyFavoriteStartups.aspx

Stanford Seminar - Software-Defined Networking at the Crossroads http://www.youtube.com/watch?v=WabdXYzCAOU

NetworkStatic | Brent Salisbury Blog http://networkstatic.net/

Network World: A conversation with Kelly Wanser, CEO of Stateless Networks http://www.statelessnetworks.com/network-world-a-conversation-with-kelly-wanser-ceo-of-stateless-networks/

@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@bluemalkin
bluemalkin / terraform-2tier-vpc
Last active November 16, 2019 04:22
Terraform 2 tier VPC with nat
# define some variables
variable "aws_ubuntu_ami" {
default = "ami-972444ad"
}
variable "aws_keypair" {
default = "xxxx"
}
# AWS account details
@bishboria
bishboria / springer-free-maths-books.md
Last active April 25, 2024 06:27
Springer made a bunch of books available for free, these were the direct links