Skip to content

Instantly share code, notes, and snippets.

View dmytro's full-sized avatar

Dmytro Kovalov (uk: Дмитро Ковальов) dmytro

View GitHub Profile
@ipmb
ipmb / ratelimit.nginxconf
Last active April 5, 2024 00:46
Nginx reverse proxy with rate limiting
upstream myapp {
server 127.0.0.1:8081;
}
limit_req_zone $binary_remote_addr zone=login:10m rate=1r/s;
server {
listen 443 ssl spdy;
server_name _;
# The initial was for Varnish 2.1, this has been updated for Varnish 3.
# The upgrade changes were based on the docs here:
# https://www.varnish-cache.org/docs/3.0/installation/upgrade.html
# https://www.varnish-cache.org/docs/2.1/tutorial/vcl.html
# https://www.varnish-cache.org/trac/wiki/VCLExamples
# Summary
# 1. Varnish will poll the backend at /health_check to make sure it is
# healthy. If the backend goes down, varnish will server stale content
@scho
scho / login.rb
Created August 2, 2012 07:00
Authentication with Rails 3.2.7 using devise 2.0.4, netzke-core 0.7.6 and Ext JS 4.0.2
# The Login component
# Lets user type in their credentials, so they can authenticate themselves
class Sessions::Login < Netzke::Base
# Set the EXT JS class
js_base_class 'Ext.Window'
# Configure the component
#
# @return [Hash]
@kuleszaj
kuleszaj / deploy.rb
Created July 8, 2012 19:15
Capistrano Configuration to Run Puppet
require "rvm/capistrano"
...
namespace :bootstrap do
task :default do
# Specific RVM string for managing Puppet; may or may not match the RVM string for the application
set :user, "ubuntu"
# Set the default_shell to "bash" so that we don't use the RVM shell which isn't installed yet...
set :default_shell, "bash"
@akheron
akheron / remote-emacs.sh
Created March 2, 2011 11:28
Use emacsclient for editing remote files by setting this script as EDITOR in the remote machine
#!/bin/sh
#
# Use this script as your EDITOR to allow editing remote files with emacsclient.
# Works by connecting to the Emacs machine with SSH and using a suitable tramp prefix.
# How to reach this machine from the one that's running Emacs
ME=user@remote-host
# How to reach the machine that's running Emacs from this machine
THEY=user@host-running-emacs