Skip to content

Instantly share code, notes, and snippets.

@sergeyenin
sergeyenin / hug_swagger.py
Created May 23, 2018 14:32 — forked from nonamenix/hug_swagger.py
Swagger specification for hug. Ugly draft.
import inspect
import collections
from collections import OrderedDict
import hug
import logging
from apispec import APISpec
from apispec.ext.marshmallow.swagger import field2parameter
from copy import copy
@sergeyenin
sergeyenin / letsencrypt_2017.md
Created December 12, 2017 18:57 — forked from cecilemuller/letsencrypt_2020.md
How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 16.04 (including IPv6, HTTP/2 and A+ SLL rating)

There are two main modes to run the Let's Encrypt client (called Certbot):

  • Standalone: replaces the webserver to respond to ACME challenges
  • Webroot: needs your webserver to serve challenges from a known folder.

Webroot is better because it doesn't need to replace Nginx (to bind to port 80).

In the following, we're setting up mydomain.com. HTML is served from /var/www/mydomain, and challenges are served from /var/www/letsencrypt.

require ENV_PATH
class String
# http://www.devarticles.com/c/a/Development-Cycles/Tame-the-Beast-by-Matching-Similar-Strings/3/
module Soundex
Codes = {
'b' => 1,
'f' => 1,
'p' => 1,
'v' => 1,
@sergeyenin
sergeyenin / user_system_real.md
Created February 8, 2012 18:56 — forked from anildigital/user_system_real.md
Ruby Benchmark module: meanings of “user”, “system”, and “real”?

Ruby Benchmark module: meanings of “user”, “system”, and “real”?

>> Benchmark.bm(7) { |b| b.report('Report:') { s = '' ; 10000.times { s += 'a' } }  }
			 user     system      total        real
Report:  0.150000   0.010000   0.160000 (  0.156361)

These are the same times that the Unix time command or other typical benchmarking tools would report:

user: the amount of time spent executing userspace code (i.e.: your code),

@sergeyenin
sergeyenin / Gemfile
Created February 6, 2012 13:14 — forked from rwjblue/Gemfile
Simple CQL to Thrift Comparison in ruby
source :rubygems
gem 'rake'
gem 'forgery'
gem 'cassandra-cql', :path => '../cassandra-cql'
gem 'cassandra', :path => '../cassandra'
gem 'perftools.rb'
gem 'rbtrace'
@sergeyenin
sergeyenin / 01. Gemfile
Created January 3, 2012 15:28 — forked from schleg/01. Gemfile
Setup for Devise + Omniauth
gem 'pg'
group :development do
gem 'ruby-debug'
end
gem 'rake', '~> 0.8.7'
gem 'devise'
gem 'oa-oauth', :require => 'omniauth/oauth'
gem 'omniauth'
gem 'haml'
gem 'dynamic_form'
require 'ray'
class Life
Width = 1920
Height = 1080
Size = Ray::Vector2[Width, Height]
def initialize
@image = Ray::Image.new Size