Skip to content

Instantly share code, notes, and snippets.

@fc-arny
fc-arny / main.go
Created January 8, 2019 19:02
go-lot-example
/*
Пример: аукцион
Аукцион состоит из нескольких участников, которые делают постоянно увеличивающиеся ставки по лоту
Он может закончиться в следующих случаях:
1. дана максимальная ставка
2. сделано определённое количество ставок
3. прошло определённое ремя
*/
package main
@fc-arny
fc-arny / echo_color.sh
Created September 20, 2018 09:59 — forked from SkypLabs/echo_color.sh
Bash functions to display messages with color
# Green
function echo_ok {
echo -e "\033[32m[OK]\033[0m $@"
}
# Red (using strerr as output)
function echo_err {
echo -e "\033[31m[ERROR]\033[0m $@" 1>&2
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Pony Test</title>
</head>
<body>
<h1>Задание:</h1>
<ul>
<li>Необходимо сделать фильтр товаров для магазина игрушечных пони</li>
@fc-arny
fc-arny / gist:5e1a12b83f11f3673ebd
Created December 17, 2015 16:28 — forked from jessedearing/gist:2351836
Create self-signed SSL certificate for Nginx
#!/bin/bash
echo "Generating an SSL private key to sign your certificate..."
openssl genrsa -des3 -out myssl.key 1024
echo "Generating a Certificate Signing Request..."
openssl req -new -key myssl.key -out myssl.csr
echo "Removing passphrase from key (for nginx)..."
cp myssl.key myssl.key.org
openssl rsa -in myssl.key.org -out myssl.key
@fc-arny
fc-arny / gist:4bf6c9368997ba83eb3e
Created October 30, 2015 14:52 — forked from JakubOboza/gist:2008958
faye as subdomain
upstream faye {
server 127.0.0.1:9292;
}
upstream webrick{
server 127.0.0.1:3000;
}
server {
listen 80 default;
@fc-arny
fc-arny / retryable_typhoeus.rb
Last active September 4, 2015 00:19 — forked from kunalmodi/retryable_typhoeus.rb
Retry Typhoeus
module RetryableTyphoeus
require 'typhoeus'
include Typhoeus
DEFAULT_RETRIES = 1
class Request < Typhoeus::Request
def original_on_complete=(proc)
@original_on_complete = proc
require File.join(File.dirname(__FILE__), 'deploy/nginx')
require File.join(File.dirname(__FILE__), 'deploy/log')
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => true }
set :application, "appname"
set :repository, "git@giturl"
set :scm, :git
# An experiment for a capistrano 'stage' that can actually be used to
# deploy multiple feature branches at once.
# Intended to be installed config/deploy/feature_demo , when using cap
# multi-stage support: add 'feature_demo' to 'stages' in `config/deploy.rb` too.
# Run from a git feature branch `cap feature_demo deploy` to deploy to
# single machine we have all our feature demos on.
# Name of feature branch will be taken from current git checkout.
@fc-arny
fc-arny / data.rake
Created December 20, 2013 15:20
Rake task for Importing cities, countries, airports, airlines
namespace :data do
namespace :import do
task :cities do
country_codes = Hash[Country.all.map {|c| [c.iata_code, c.id]}]
import_csv_to 'cities' do |row|
country_code, city_name, city_name_en, city_lat, city_long = [*row]
country_id = country_codes[country_code] || nil
if city_name