Skip to content

Instantly share code, notes, and snippets.

Rustam Sharshenov sharshenov

Block or report user

Report or block sharshenov

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
sharshenov / nginx.conf
Created Jan 10, 2018
Nginx forward proxy with requests rate throttling
View nginx.conf
worker_processes 1;
events {
worker_connections 1024;
http {
include mime.types;
default_type application/octet-stream;
View gist:68900ac97115d020e41c5fe7faf4c5e8
# add to /etc/rc.local
# su -c '/home/rails/scripts/talkzzz'
# add to /home/rails/.profile
# PATH=$HOME/scripts/:$PATH
View inverse_of.rb
#возьмем, например, связь one-to-many и вложенными атрибутами
class Gallery < ActiveRecord::Base
has_many :images
accepts_nested_attributes_for :images
class Image < ActiveRecord::Base
belongs_to :gallery, required: true
sharshenov / .kitchen.yml
Created Nov 11, 2016
kitchen configuration with cached chef-client
View .kitchen.yml
name: vagrant
synced_folders: [
["~/.chef/pkgs", "/tmp/chef-pkgs"]
name: chef_zero
chef_omnibus_url: file:///tmp/chef-pkgs/
View gist:c09ed8955692ca98d371eeb42a1b6d45
module Exchange
module ExternalAPI
class Nbkr < XML
API_URL = ""
CURRENCIES = %W(kgs usd eur kzt rub).map(&:to_sym)
def update opts={}
sharshenov / gist:edaca25b3b9094359c95f4ae66cd4222
Created Jul 22, 2016
Using wkhtmltopdf without X server
View gist:edaca25b3b9094359c95f4ae66cd4222
apt-get install wkhtmltopdf
apt-get install xvfb
echo -e '#!/bin/bash\nxvfb-run -a --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf -q $*' > /usr/bin/
chmod a+x /usr/bin/
ln -s /usr/bin/ /usr/local/bin/wkhtmltopdf
wkhtmltopdf output.pdf
View throttler.rb
class Throttler
class << self
def limit *attrs
throttler.limit *attrs
sharshenov / gist:793e6dee2c5bee9d82d6
Last active Dec 5, 2016
Конфигурация elasticsearch для нужд небольших проектов(никакого HighAvailability & Load Balancing)
View gist:793e6dee2c5bee9d82d6
# Добавляем репозиторий для oracle java
add-apt-repository ppa:webupd8team/java
# Добавляем репозиторий для elasticsearch
wget -qO - | sudo apt-key add -
echo "deb stable main" | sudo tee -a /etc/apt/sources.list.d/elasticsearch-2.x.list
# Обновить систему
apt-get update && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get clean
sharshenov / gist:33c0dd55c838ecd5762c
Created Nov 16, 2015
Rails middleware for health check endpoint
View gist:33c0dd55c838ecd5762c
class HealthCheckResponder
def initialize(app, options = {})
@app = app
def call(env)
if env["REQUEST_PATH"] == "/health_check"
return [200, {}, [""]]
sharshenov / 404.html
Created Aug 20, 2015
Page not found for RoR
View 404.html
<h1>Page not found</h1>
You can’t perform that action at this time.