Skip to content

Instantly share code, notes, and snippets.

View ilyabrin's full-sized avatar
Go, JavaScript

Ilya Brin ilyabrin

Go, JavaScript
View GitHub Profile
@ilyabrin
ilyabrin / unicorn.rb
Created July 17, 2015 13:28
Template for Ruby on Rails + Unicorn appname/config/unicorn.rb
# set path to application
app_dir = File.expand_path("../..", __FILE__)
shared_dir = "#{app_dir}/shared"
working_directory app_dir
# Set unicorn options
worker_processes 2
preload_app true
timeout 30
@ilyabrin
ilyabrin / unicorn_appname.sh
Created July 17, 2015 13:17
Template for Ruby on Rails + Unicorn /etc/inid.d/unicorn_appname
#!/bin/sh
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the unicorn app server
# Description: starts unicorn using start-stop-daemon
@ilyabrin
ilyabrin / db.rb
Created July 14, 2015 12:25
Example of Rail config
default: &default
adapter: postgresql
encoding: unicode
username: user
password: password
pool: 5
development:
<<: *default
database: some_database_development
@ilyabrin
ilyabrin / task6.rb
Last active August 29, 2015 14:21 — forked from Aduciicba/task6.rb
class Road < Object
attr_accessor :low_bound,
:high_bound,
:transport_count,
:road_id,
:counter
end
file = File.open('F:/input.txt', 'r')
context "HAPPY PATHS" do
#...
scenario "create a parking lot and check hints count" do
@tenant.default_location.parking_lots.first.destroy
click_link "Create Parking Lot"
fill_in "Name", with: "Parking Lot 4"
select "Corporate", from: "Workgroup"
click_button "Submit"
success_messages ["Parking Lot successfully created."]
has_no_error_message
@ilyabrin
ilyabrin / reporter.rb
Created March 20, 2015 15:05
Reporter.rb - pattern Strategy
class HTMLFormatter
def output_report(context)
p %Q{
<html>
<head>
<title>#{context.title}</title>
</head>
<body>
}
context.text.each do |line|
@ilyabrin
ilyabrin / untar.rb
Created February 24, 2015 09:38
Untar archive *.tar.gz
#!/usr/bin/ruby
def extract_tar_gz (file_path)
if File.exists?(file_path)
system "tar -xvz -C . -f #{file_path}"
end
end
@ilyabrin
ilyabrin / nginx.conf
Created February 18, 2015 15:54
NGINX - SSL Config (ssllabs.com rate like A+)
listen 443 ssl spdy;
ssl on;
ssl_protocols TLSv1.2 TLSv1.1 TLSv1;
ssl_session_cache shared:SSL:20m;
ssl_session_timeout 10m;
ssl_ciphers 'EECDH+ECDSA+AESGCM:AES128+EECDH:AES128+EDH:!RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS:!CAMELLIA:!ADH';
ssl_prefer_server_ciphers on;
resolver 8.8.8.8 8.8.4.4 valid=300s;
resolver_timeout 10s;
@ilyabrin
ilyabrin / git_bare_push.sh
Created December 25, 2014 15:27
Git --bare push
### Как сделать push в --bare репозиторий
git init
touch .gitignore
git add .gitignore
git commit -m "Initial commit"
@ilyabrin
ilyabrin / xls_xample.rb
Created December 24, 2014 11:01
XSL Ruby Spreadsheet
#!/usr/bin/env ruby
# encoding: utf-8
require 'spreadsheet'
p "Start"
# Write
row_1 = ['A1', 'B1']
row_2 = ['A2', 'B2']