Skip to content

Instantly share code, notes, and snippets.

Avatar

Renato Zannon renato-zannon

View GitHub Profile
@renato-zannon
renato-zannon / README.md
Last active Oct 1, 2021
Verify if host will have Let's encrypt certificate validation problems
View README.md

Running the script inside a docker container

If you wish to test whether your docker container won't have issues when the old Root certificate expires, you can run the script inside the container itself.

In order to do this, follow these steps:

  1. Download the verify-lets-encrypt.sh script from the gist
  2. Bring up your application container as you usually do - with docker-compose up, docker run, via VS Code etc
  3. Run docker ps, and look for any application containers that are up; the NAMES column is the easiest for that
  4. From the same folder where you've downloaded the script, run docker exec -i <CONTAINER_NAME_OR_ID> /bin/sh < verify-lets-encrypt.sh; this will run the script inside the container
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
store: Ember.inject.service(),
actions: {
createClosing() {
const closing = this.get('store').createRecord('closing');
this.set('closing', closing);
View keybase.md

Keybase proof

I hereby claim:

  • I am renato-zannon on github.
  • I am renato_zannon (https://keybase.io/renato_zannon) on keybase.
  • I have a public key whose fingerprint is 723E BFA3 0EBE 26C6 4310 5364 6C26 8AF6 75E7 D62E

To claim this, I am signing this object:

@renato-zannon
renato-zannon / results
Created Jun 5, 2014
Rust: Semaphores vs channels
View results
running 2 tests
test with_channels ... bench: 876410 ns/iter (+/- 655463)
test with_semaphores ... bench: 513476 ns/iter (+/- 711503)
test result: ok. 0 passed; 0 failed; 0 ignored; 2 measured
@renato-zannon
renato-zannon / patch.rb
Created Mar 20, 2014
Fix rails 2.3 filter_parameter_logging for ruby 2.x
View patch.rb
# The filter_parameter_logging method, used to filter request parameters
# (such as passwords) from the log, defines a protected method called
# filter_parameter when called. Its existence is later tested using
# respond_to?, without the include_private parameter. Due to the respond_to?
# behavior change, the method existence is never detected, and parameter
# filtering stops working.
require 'action_controller'
module ParameterFilterPatch
def respond_to?(method, include_private = false)
View nth_child.rb
require 'nokogiri'
require 'rspec'
describe "nth-child" do
let(:doc) do
Nokogiri::HTML(<<-HTML)
<html>
<body>
<p id="first"></p>
<p id="second"></p>
View fiber-example.rb
# Depends on gems eventmachine, em-http-request,
# and em-resolv-replace (for # async DNS)
require 'eventmachine'
require 'em-http'
require 'fiber'
require 'em-resolv-replace'
def make_request_to(url)
connection = EventMachine::HttpRequest.new(url)
@renato-zannon
renato-zannon / module.rb
Created Sep 4, 2012
Subclass module + use module_eval to define methods
View module.rb
class AttributeAccessor < Module
def initialize(name)
@name = name
module_eval { define_accessors }
end
private
def define_accessors
ivar = "@#{@name}"
@renato-zannon
renato-zannon / user.rb
Created Jun 9, 2012
Strategy pattern to follow users
View user.rb
class User < Struct.new(:username, :private)
alias_method :private?, :private
def follow
follow_strategy.call
end
private
def follow_strategy
@renato-zannon
renato-zannon / xmonad-unity.desktop
Created Jan 13, 2012
Unity Panel + XMonad config
View xmonad-unity.desktop
# /usr/share/xsessions/xmonad-unity.desktop
[Desktop Entry]
Encoding=UTF-8
Name=XMonad/Unity
Comment=Xmonad+Unity
Exec=gnome-session --session=xmonad_unity
Icon=xmonad.png
Type=Application