This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import tornado.httpserver, tornado.ioloop, tornado.options, tornado.web, os.path | |
| from tornado.options import define, options | |
| define("port", default=8888, help="run on the given port", type=int) | |
| class Application(tornado.web.Application): | |
| def __init__(self): | |
| handlers = [ | |
| (r"/", HomeHandler), | |
| (r"/upload", UploadHandler) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ADD this to Rakefile and run it by issuing rake roles.to_json | |
| ROLE_DIR = File.expand_path(File.join(TOPDIR, "roles")) | |
| namespace :roles do | |
| desc "Convert ruby roles from ruby to json, creating/overwriting json files." | |
| task :to_json do | |
| Dir.glob(File.join(ROLE_DIR, '*.rb')) do |rb_file| | |
| role = Chef::Role.new | |
| role.from_file(rb_file) | |
| json_file = rb_file.sub(/\.rb$/,'.json') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import copy | |
| # Имплементация прототип ориентированного internal DSL для Python по мотивам Io Language http://habrahabr.ru/blogs/crazydev/28041/ | |
| # Implementation of prototype oriented internal DSL for python based on article about Io Language http://habrahabr.ru/blogs/crazydev/28041/ | |
| class IoObject(dict): | |
| def __init__(self): | |
| self.clone = copy.copy | |
| def __getattr__(self, attr): | |
| if 'get_slot' in self: | |
| val = self["get_slot"](attr)#может вызвать бесконечность / infinite loop can occur |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/opt/csw/bin/ruby | |
| # | |
| # run with something like iostat -nx 10 | iostat_to_graphite.rb | |
| # | |
| require 'socket' | |
| graphite_host='graphite' | |
| graphite_port=2003 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class OnDestroyMiddleware | |
| def initialize(app, env) | |
| @app = app | |
| end | |
| def call(env) | |
| env["config"].vm.provisioners.each do |provisioner| | |
| env.ui.info "Attempting to remove client #{provisioner.config.node_name}" | |
| `knife client show #{provisioner.config.node_name}` | |
| if $?.to_i == 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #################################### | |
| # BASIC REQUIREMENTS | |
| # http://graphite.wikidot.com/installation | |
| # http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/ | |
| # Last tested & updated 10/13/2011 | |
| #################################### | |
| sudo apt-get update | |
| sudo apt-get upgrade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Quick gist on getting vsphere and vcenter and fog/vsphere going | |
| # Things to download | |
| - Download free evaluation version of window 2008 | |
| - Download free evaluation of esxi v5 | |
| - Download free evaluation of esxi vsphere (control center) iso | |
| # Install esxi in vmware fusion | |
| 1)Install esxi in vmware (select vmware/esx as host) | |
| create a user root/pipopopo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pyparsing import * | |
| # By default, PyParsing treats \n as whitespace and ignores it | |
| # In our grammer, \n is significant, so tell PyParsing not to ignore it | |
| ParserElement.setDefaultWhitespaceChars(" \t") | |
| def parse(input_string): | |
| def convert_prop_to_dict(tokens): | |
| """Convert a list of field property tokens to a dict""" | |
| prop_dict = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| for cookbook in $(find * -type d -maxdepth 0); do | |
| git clone ./ ../${cookbook} | |
| cd ../${cookbook} | |
| git remote rm origin | |
| git filter-branch --subdirectory-filter ${cookbook} -- --all | |
| git gc --aggressive | |
| done |
OlderNewer