Skip to content

Instantly share code, notes, and snippets.

Maksym Melnychok keymone

Block or report user

Report or block keymone

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
View graph.rb
# Generates infrastructure graph in DOT format
# Usage:
# $ find . -name '*.pp' | while read file; do cat $file; echo; done | \
# ruby graph.rb >
NODE = /^\s*(class|define|node)(\s+)([\w:]+)/
RELATION = /^\s*(inherits|include)(\s+)([\w:]+)/
RELATION2 = /^\s*class(\s+)\{\s*(['"]?)([\w:]+)/
USAGE = /^\s*([\w:]*[\w])(\s*)\{(\s*)/
IGNORE = %w{file package service cron exec Exec line plugin user group class
View puppet_autoload_patch.rb
require 'rubygems'
require 'puppet/util/autoload'
class Puppet::Util::Autoload
class << self
def search_directories(env=nil)
@search_directories ||= {}
# cache only after initialization
if Puppet.settings.app_defaults_initialized?
@search_directories[env] ||= search_directories_uncached(env)
View gist:04c4670a466b2af85236 do
@redis.keys("*checks*pattern*") do |keys|
@redis.get(keys) do |values|
values.each do |value|
check = MultiJson.load(value) rescue nil
next unless check
if check[:keepalive]
@redis.get("execution:key:#{check[:name]}") do |exec_time|
publish_critical if exec_time < - check[:keepalive]

Keybase proof

I hereby claim:

  • I am keymone on github.
  • I am keymone ( on keybase.
  • I have a public key whose fingerprint is 664F 307D 773C 265C 2054 E89C BAEB B0D1 CA5B 3B07

To claim this, I am signing this object:

View .vimrc
" mv ~/.vim ~/.vim.old; mkdir -p ~/.vim/bundle; pushd ~/.vim/bundle;
" git clone; vim +PluginInstall; popd
set nocompatible
" < vundle and plugins >
filetype off
View anonymous.cljs
(defn baz [a] a)
; this does something and then returns anonymous function, closure is important
(defn bar [] (let [a b] #(do (baz a) )))
; this gets anonymous function as input and calls it
(defn foo [arg] (arg))
(foo (bar))
View gist:19393
% list of {type, flag} tuples
pack(List) -> pack(List, <<>>).
pack([], Ready) -> Ready;
pack([{Type, Flag}|Rest], Ready) ->
Bit = ?MODULE:Type(Flag) - 1,
Size = size(Ready) * 8,
io:format("switch bit ~p in ~p bits~n", [Bit, Size]),
switch(Bit, Size, Rest, Ready).
View gist:78790
-export([encode/1, decode/1]).
encode(Binary) ->
encode(Binary, <<>>).
encode(<<>>, To) -> To;
encode(<<B:1>>, To) -> <<To/binary, (symbol(B)), "====">>;
encode(<<B:2>>, To) -> <<To/binary, (symbol(B)), "=">>;
encode(<<B:3>>, To) -> <<To/binary, (symbol(B)), "=======">>;
View upgrade.rb
#!/bin/env ruby
require 'fileutils'
puts "Scanning for available drupal versions"
available = Dir['*'].map do |file|
if file =~ /^drupal-#{DRUPAL_MAJOR}\.(\d+)$/
keymone / gist:1827669
Created Feb 14, 2012
View gist:1827669
class IO
def each_lines_batch(batch_size=1000, buffer_size=4096)
lines = []
chunk = ""
while data =
chunk << data
lines += chunk.lines.to_a
# last line might not be read until it's end
You can’t perform that action at this time.