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
@kesor
kesor / vimrc_snippet.vim
Created May 22, 2012 10:04
Python nosestests running in vim
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" SWITCH BETWEEN TEST AND PRODUCTION CODE
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
function! OpenTestAlternate()
let new_file = AlternateForCurrentFile()
exec ':e ' . new_file
endfunction
function! AlternateForCurrentFile()
let current_file = expand("%")
let current_path = expand("%:h")
@kesor
kesor / rack_test_middleware.rb
Created June 5, 2012 05:44
rack-middleware blog post
require 'rack/test'
describe SampleMiddleware do
include Rack::Test::Methods
let(:inner_app) do
lambda { |env| [200, {'Content-Type' => 'text/plain'}, ['All good!'] }
end
let(:app) { SampleMiddleware.new(inner_app) }
#
# installs and configures a graphite server
#
# depends on two modules from:
# - https://github.com/uggedal/puppet-module-nginx
# - https://github.com/uggedal/puppet-module-python
# global path for exec
Exec {
path => "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
#!/bin/sh
curl -XPUT "http://localhost:9200/_template/rsyslog_per_index?pretty=true" -d '
{
"template" : "rsyslog*",
"settings" : {
"number_of_shards" : 4,
"index.cache.field.type" : "soft",
"index.refresh_interval" : "5s",
"index.store.compress.stored" : true,
@kesor
kesor / verbose output
Last active December 14, 2015 08:09
knife 11.4 error for uploading frozen cookbooks
ERROR: knife encountered an unexpected error
This may be a bug in the 'cookbook upload' knife command or plugin
Please collect the output of this command with the `-VV` option before filing a bug report.
Exception: NameError: undefined local variable or method `cookbook' for #<Chef::Knife::CookbookUpload:0x007fb50ac8d4c8>
@kesor
kesor / templated_questions.coffee
Created March 18, 2013 12:24
JavaScript templated questioneer
renderTemplate = (template, data) ->
template
.replace(/{{example_page}}/g, data["example_page"])
.replace(/{{page_type}}/g, data["page_type"])
mockupHtmlTemplate = '<div>
<label>Example page:<input onchange="textChanged(this)" name="example_page" value="{{example_page}}"></label><br/>
<label>Page type:<input onchange="textChanged(this)" name="page_type" value="{{page_type}}"></label>
</div>'
require 'fog'
connection = Fog::Compute.new(
provider: 'AWS',
aws_access_key_id: 'AKIAIEXAMPLEEXAMPLE6',
aws_secret_access_key: 'example+example+example+example+example7',
region: 'us-east-1'
)
connection.servers.all.each do |server|
puts server.id
@kesor
kesor / Gemfile
Created March 19, 2013 00:32
Vagrant configuration to install two Ubuntu 12.04 servers, first server has a Chef Server installed, second server has a Chef Client installed, and the folder where these files are places is configured to be a Chef Workstation using admin.pem.
source "https://rubygems.org"
gem 'chef', '>= 11.0'
gem 'librarian'
gem 'vagrant', '= 1.0.6'
gem 'vagrant-hostmaster'
gem 'foodcritic'
@kesor
kesor / gist:5411806
Last active December 16, 2015 09:19
## using https://github.com/apsoto/monit/ cookbook
## this works
bind_cookbook_name = cookbook_name
monitrc 'redis' do
action :enable
reload :delayed
variables({ :pidfile => "/var/run/redis/6379/redis_6379.pid" })
template_cookbook bind_cookbook_name
template_source 'redis_monit.conf.erb'
AJS.toInit(function () {
AJS.$("[name=run_dynamic_publisher_id]").select2({width: "400px"});
$("[class^=atlassian-select2]").each(function (ei, ee) {
ee.className = ee.className.replace("atlassian-select2", "select2");
});
})