Skip to content

Instantly share code, notes, and snippets.

View Kroid's full-sized avatar

George Kroid

  • uchi.ru
  • Russia/Moskow
View GitHub Profile
@Kroid
Kroid / gist:dc7d6cae660d5e0f017b
Created July 9, 2014 20:17
terminal messages
.=Имя
.=Открыть
.=НЕОТП.
.=ЗАРЕЗ.
.=ОТП.
.=Места на палете не достаточно, но если зарезервированный товар увезен, то места хватит. Уточните у кладовщика возможность размещения. Размещение приведет к переполнению ячейки. Продолжить?
...=Нет доступа к вложению
...=Плохие паллеты
=Нет доступа к вложению
...=Есть доступ к вложению

How to add environment variables to nginx.conf

This is the hack approach to adding environment variables to the nginx configuration files. As with most Google results for this search, the reason is Docker.

The setup

I intended to deploy two Docker containers.

@Kroid
Kroid / deploy.rb
Last active August 29, 2015 14:23 — forked from trushkevich/deploy.rb
set :private_pub_pid, -> { "#{current_path}/tmp/pids/private_pub.pid" }
namespace :private_pub do
desc "Start private_pub server"
task :start do
on roles(:app) do
within release_path do
with rails_env: fetch(:stage) do
execute :bundle, "exec thin -C config/private_pub/thin_#{fetch(:stage)}.yml -d -P #{fetch(:private_pub_pid)} start"
end
@Kroid
Kroid / example.rb
Created March 9, 2017 08:38
grape-like params validation
require 'json'
class Hash
def try(*a, &b)
if a.empty? && block_given?
yield self
else
__send__(*a, &b)
end
end
@Kroid
Kroid / latency.txt
Created April 21, 2017 12:46 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@Kroid
Kroid / genesis.json
Created September 26, 2017 20:10 — forked from dickolsson/genesis.json
Example genesis.json for an Ethereum blockchain
{
"config": {
"chainId": 33,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"nonce": "0x0000000000000033",
"timestamp": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
function round(bool) {
let answer = false;
if (Math.random() > 0.3) answer = true;
if (bool == answer) return 1;
return -1;
}
let result;
result = 0;
@Kroid
Kroid / rspec_boolean_matcher.rb
Created March 25, 2018 09:15 — forked from koriroys/rspec_boolean_matcher.rb
rspec boolean matcher
require 'rspec/expectations'
RSpec::Matchers.define :be_boolean do
match do |actual|
[true, false].include? actual
end
failure_message_for_should do |actual|
"expected that #{actual.inspect} would be a boolean(true or false)"
end
@Kroid
Kroid / Sentry-Install-Ubuntu-16-04
Created June 5, 2018 12:46
Setup sentry on Ubuntu 16.04 server
# Project: https://github.com/getsentry/sentry
# Doc: https://docs.getsentry.com/on-premise/server/installation/python/
sudo apt-get update
sudo apt-get install python-virtualenv
sudo apt-get install python-setuptools
sudo apt-get install python-pip
sudo apt-get install libxslt1-dev
sudo apt-get install gcc
@Kroid
Kroid / Sentry-Install-Ubuntu-16-04
Last active June 6, 2018 06:58
Setup sentry on Ubuntu 16.04 server
# Project: https://github.com/getsentry/sentry
# Doc: https://docs.getsentry.com/on-premise/server/installation/python/
sudo apt-get update
sudo apt-get install python-virtualenv
sudo apt-get install python-setuptools
sudo apt-get install python-pip
sudo apt-get install libxslt1-dev
sudo apt-get install gcc