View swagger.slim
This file contains 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
doctype html | |
html[lang="en"] | |
head | |
meta(charset="UTF-8") | |
title Installments API | |
link[rel="stylesheet" type="text/css" href="//unpkg.com/swagger-ui-dist@3/swagger-ui.css"] | |
body | |
#swagger-ui |
View debug.conf
This file contains 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
# run with: | |
# nginx -c $(pwd)/debug.conf | |
daemon off; | |
worker_processes 1; | |
events { | |
worker_connections 128; | |
} |
View icco_example.rb
This file contains 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
gem 'fog-core', '>2.0' | |
gem 'fog-backblaze' | |
require 'fog/core' | |
require 'fog/backblaze' | |
TEST_BUCKET = ENV['B2_BUCKET'] || 'fog-demo-1505931432' | |
if !ENV['B2_ACCOUNT_ID'] || ENV['B2_ACCOUNT_ID'] == "" | |
puts "Missing env B2_ACCOUNT_ID" |
View connect.rb
This file contains 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
tcp_socket = Socket.tcp("mysite.com", 32500, connect_timeout: 60) | |
ssl_context = OpenSSL::SSL::SSLContext.new() | |
ssl_context.client_cert_cb = Proc.new do | |
[ | |
OpenSSL::X509::Certificate.new(File.open("./client.crt")), | |
OpenSSL::PKey.read(File.open("./client.key")) | |
] | |
end |
View _usage.js
This file contains 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
const express = require('express'); | |
const asyncRouter = require('../lib/async_router'); | |
var router = asyncRouter(express.Router()); | |
router.get('/', async (req, res, next) => { | |
// mkaing async errors | |
}); |
View 1.rb
This file contains 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
desc "Create rabbitmq setup" | |
task :setup_rabbit => :environment do | |
QueueWorker::HostSelector.mute_logger | |
Rails.logger = Logger.new(STDOUT) | |
options = {} | |
if ENV['UNDO'] | |
options = {delete_all: true, raise_errors: false} | |
end | |
if ENV['RECREATE'] |
View 1_output_jakarta_to_singapore.txn
This file contains 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
Run from cloud server in Jakarta, sending requests to cloud server in Singapore | |
Warming up -------------------------------------- | |
excon 1.000 i/100ms | |
net-http2 1.000 i/100ms | |
net-http 1.000 i/100ms | |
net-http2 persistent 6.000 i/100ms | |
excon persistent 5.000 i/100ms | |
http persistent 6.000 i/100ms | |
Calculating ------------------------------------- |
View async.rb
This file contains 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
module Async | |
## | |
# Run code in thread, handle exceptions, release DB connections | |
# | |
# Async(:send_email) { Mailer.send } | |
# | |
def self.run(name) | |
parent_t = Thread.current | |
working_thread = Thread.new do | |
begin |
View ar_pool_stats.rb
This file contains 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
unless ActiveRecord::ConnectionAdapters::ConnectionPool.method_defined?(:stat) # will be in Rails 5.1 | |
class ActiveRecord::ConnectionAdapters::ConnectionPool | |
def stat | |
synchronize do | |
{ | |
size: size, | |
connections: @connections.size, | |
busy: @connections.count { |c| c.in_use? && c.owner.alive? }, | |
dead: @connections.count { |c| c.in_use? && !c.owner.alive? }, | |
idle: @connections.count { |c| !c.in_use? }, |
View .tm_properties
This file contains 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
invisiblesMap = "~ \t┊" | |
include = "{$include,.*}" | |
exclude = "{$exclude,.git,tmp/cache}" |
NewerOlder