Skip to content

Instantly share code, notes, and snippets.

View kesor's full-sized avatar
Working from home

Evgeny Zislis kesor

Working from home
View GitHub Profile
View refrigerator.pp
ensure => running,
kesor / Vagrantfile
Last active August 29, 2015 14:02
docker workshop
View Vagrantfile
Vagrant.configure("2") do |v| = "yungsang/boot2docker"
v.vm.box_version = ">= 1.3.7"
v.vm.box_check_update = false :forwarded_port, guest: 5000, host: 60050 :forwarded_port, guest: 8500, host: 60085 :forwarded_port, guest: 8080, host: 60080
View gist:11682
# Cleanup World of Warcraft AddOns folder from embedded libraries,
# only if those are installed individually or as part of a library pack (eg. Ace3)
# Usual dir on a Mac OS X is at :
# ~/Applications/World of Warcraft/Interface/AddOns
# Useful shell alias
kesor / rails_vendor_gems_ng.rb
Created December 29, 2008 20:45
handle vendor/gems in rails 2.2 as a dir for gems, not foreign alien shit that it is today
View rails_vendor_gems_ng.rb
# see mail reply in
# with explanation about how/why this works better than rails 2.2
module Rails
class VendorGemSourceIndex
def gemspec_filename(d)
kesor /
Last active September 9, 2015 11:18
Uploading ssl to AWS
decrypted_rsa_key=$(mktemp `dirname $0`/${cert_name}-com-server-key-UNENCRYPTED.pem.XXXXXXX)
trap "rm -rf $decrypted_rsa_key" EXIT
openssl rsa -in ${cert_name}-com-server-key.pem -out $decrypted_rsa_key
# The certificate chain must start with the immediate signing certificate,
kesor / gist:1029749
Created June 16, 2011 17:27
RSyslog <-> ElasticSearch LogStash events
We couldn’t find that file to show.
kesor /
Created September 20, 2011 17:12
Django SQL dump middleware
from django.conf import settings
from django.db import connection
class SqldumpMiddleware(object):
def process_response(self, request, response):
if settings.DEBUG and 'sqldump' in request.GET:
response.content = str(connection.queries)
response['Content-Type'] = 'text/plain'
return response
kesor /
Created September 28, 2011 11:47
Django Jinja2 Loader
import jinja2
from django.template.loader import BaseLoader
from django.template.loaders.app_directories import app_template_dirs
from django.template import TemplateDoesNotExist, Origin
from django.core import urlresolvers
from django.conf import settings
import datetime
import urllib
from django.utils.timesince import timesince, timeuntil
kesor /
Created April 15, 2012 14:44
Django X-Host-Name + X-Host-IP +X-Host-MacAddress middleware
class HostnameMiddleware(object):
"""Middleware that adds a header X-Hostname to erroneous pages."""
def process_response(self, request, response):
if response.status_code != 200:
import socket
hostname = socket.gethostname()
addresses = ",".join( socket.gethostbyname_ex(hostname)[2] )
response['X-Host-Name'] = hostname
response['X-Host-IP'] = addresses
kesor / jQuery_each_slice.js
Created May 6, 2012 13:35
jQuery Each Slice loop
View jQuery_each_slice.js
/* definition */
$.fn.each_slice = function( iterator ) {
var index, objects;
objects = this;
for (index=0; index<=objects.length-1; index++) {
var single = objects.slice(index, index+1);
this = single;