Skip to content

Instantly share code, notes, and snippets.

require 'minitest/autorun'
class Integer
# rules:
# - Si a la derecha de una cifra romana de escribe otra igual o menor, el valor de ésta se suma a la anterior.
# - La cifra "I" colocada delante de la "V" o la "X", les resta una unidad; la "X", precediendo a la "L" o a la "C", les resta diez unidades y la "C", delante de la "D" o la "M", les resta cien unidades.
# - En ningún número se puede poner una misma letra más de tres veces seguidas. En la antigüedad se ve a veces la "I" o la "X" hasta cuatro veces seguidas.
# - La "V", la "L" y la "D" no pueden duplicarse porque otras letras ("X", "C", "M") representan su valor duplicado.
# - Si entre dos cifras cualesquiera existe otra menor, ésta restará su valor a la siguiente.
@flowerett
flowerett / osx-10.11-setup.md
Created January 2, 2016 15:35 — forked from kevinelliott/osx-10.11-setup.md
Mac OS X 10.11 El Capitan Setup

Mac OS X 10.11 El Capitan

Custom recipe to get OS X 10.11 El Capitan running from scratch, setup applications and developer environment. This is very similar (and currently mostly the same) as my 10.10 Yosemite setup recipe (as found on this gist https://gist.github.com/kevinelliott/0726211d17020a6abc1f). Note that I expect this to change significantly as I install El Capitan several times.

I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

@flowerett
flowerett / elastic_default.rb
Created April 6, 2016 06:55
Elasticsearch chef recipe
#
# Cookbook Name:: elasticsearch
# Recipe:: default
#
# Credit goes to GoTime for their original recipe ( http://cookbooks.opscode.com/cookbooks/elasticsearch )
if ['solo', 'util'].include?(node[:instance_role])
elasticsearch_instances = []
elasticsearch_expected = 0
instances = node[:engineyard][:environment][:instances].select{|i| ['util', 'solo'].include?(i['role']) }
@flowerett
flowerett / mina tag version
Last active January 12, 2017 21:44
Mina git tag
Tag deployed git sha with the current release version
1. mina deploy --simulate > script.sh
Take a look at the script, and decide where you want your command to go.
2. Figure out how to do what you want in a shell command, for instance, it might be something like VERSION=$(cat version.txt) git tag -a -m "$VERSION" HEAD; git push --tags
3. Add a line in the appropriate spot to config/deploy.rb saying queue %( VERSION=$(cat version.txt) git tag -a -m "$VERSION" HEAD; git push --tags )
@flowerett
flowerett / rails-options
Created January 12, 2017 21:42
rails new options
rails new --help
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/flowerett/.rvm/rubies/ruby-2.3.3/bin/ruby
-m, [--template=TEMPLATE] # Path to some application template (can be a filesystem path or URL)
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
# Default: sqlite3
@flowerett
flowerett / Sidekiq Reset
Created February 16, 2017 09:48 — forked from unkleara/Sidekiq Reset
Sidekiq reset stats
To reset processed jobs:
Sidekiq.redis {|c| c.del('stat:processed') }
To reset failed jobs:
Sidekiq.redis {|c| c.del('stat:failed') }
To reset statistics:
Sidekiq::Stats.new.reset
@flowerett
flowerett / q1.rb
Created May 16, 2017 09:19
Module
module C
def foo
"module C - instance method"
end
def foo
"module C - class method"
end
end
def dispatch(command, value = nil)
case command
when :create_parking_lot
@lot = create_parking_lot(value)
when :park
park(value)
when :leave
leave(value)
when :status
status
//1
for (var i = 0; i < 10; i++) {
setTimeout(function () {
console.log(i);
}, 0);
}
//2
var a = {
lol: 'xxx'
@flowerett
flowerett / Rancher.md
Created April 5, 2018 19:27 — forked from lmmendes/Rancher.md
Running Rancher locally (with two hosts) using MacOS Docker and VirtualBox

Rancher

Rancher is an open source project that provides a complete platform for operating Docker in production. It provides infrastructure services such as multi-host networking, global and local load balancing, and volume snapshots.

This documentation describes how to run Rancher localy for development and evaluation propuses.

I'm using Docker for OSX (native) but even for this to work you will need to install VirtualBox.

Launching Management Rancher Server