This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Munin plugins for Passenger: | |
- Put the files passenger_status and passenger_memory_status in /etc/munin/plugins | |
- Configure the Passenger instance registry directory in Apache, nginx or Passenger Standalone to /var/run/passenger | |
- Edit /etc/munin/plugin-conf.d/munin-node to include: | |
[passenger_*] | |
user root | |
env.PASSENGER_INSTANCE_REGISTRY_DIR /var/run/passenger | |
command ruby %c | |
- Restart munin-node |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[[ -z "$1" ]] && exit 1 | |
float_div () # Arguments: dividend and divisor | |
{ | |
if [ $2 -eq 0 ]; then echo division by 0; exit; fi | |
local p=12 # precision | |
local c=${c:-0} # precision counter | |
local d=. # decimal separator |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'minitest/autorun' | |
class VoiceServiceTest < Minitest::Test | |
def test_calls_remote_service | |
remote_service_mock = Minitest::Mock.new | |
remote_service_mock.expect(:call, { result: 'ochenta y ocho'}.to_json, ['88.wav']) | |
result = nil | |
RemoteService.stub(:request_recognize, remote_service_mock) do | |
result = VoiceService.recognize('88.wav') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Valencia DevOps 2016-04-19 | |
Omar | |
Consul and consul-template | |
https://hub.docker.com/_/ruby/ | |
progrium/consul | |
gliderlabs/registrator | |
HOW TO |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'dotenv' | |
require 'uri' | |
require 'mongo' | |
require 'securerandom' | |
Dotenv.load | |
def format_uri(uri) | |
index = (uri =~ /@/) | |
index = (uri =~ /\/{2}/) + 1 unless index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'dotenv' | |
require 'uri' | |
require 'mongo' | |
Dotenv.load | |
abort "Not to be run in production!!" if ENV['RACK_ENV'] == 'production' | |
def format_uri(uri) | |
index = (uri =~ /@/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'dotenv' | |
require 'uri' | |
require 'mongo' | |
Dotenv.load | |
def format_uri(uri) | |
index = (uri =~ /@/) | |
index = (uri =~ /\/{2}/) + 1 unless index | |
uri[index+1..-1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'dotenv' | |
require 'uri' | |
require 'mongo' | |
require 'active_support/inflector' | |
Dotenv.load | |
def format_uri(uri) | |
index = (uri =~ /@/) | |
index = (uri =~ /\/{2}/) + 1 unless index |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OCR | |
OCR_MAP = { | |
" _ | ||_|" => 0, | |
" | |" => 1, | |
" _ _||_ " => 2, | |
" _ _| _|" => 3, | |
" |_| |" => 4, | |
" _ |_ _|" => 5, | |
" _ |_ |_|" => 6, | |
" _ | |" => 7, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# see: https://askubuntu.com/questions/62095/how-to-alias-git-to-g-so-that-bash-completion-rules-are-preserved/62098#62098 | |
git_alias_complete() | |
{ | |
alias='g' | |
complete -o bashdefault -o default -o nospace -F _git g 2>/dev/null \ | |
|| complete -o default -o nospace -F _git $alias | |
} |
NewerOlder