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
| module ANSI | |
| class << self | |
| ESC = "\x1B" | |
| CSI = ESC + "[" | |
| def cursor_up(n = 1) | |
| "#{CSI}#{n}A" | |
| end | |
| def cursor_down(n = 1) |
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
| unset OLD_GOPATH | |
| # Try to find the nearest GOPATH under the given dir | |
| func goproj_home() { | |
| local dir="${1:-"$PWD"}/" | |
| until [[ -z "$dir" ]]; do | |
| dir="${dir%/*}" | |
| if [[ -d "$dir/src" ]] && [[ -d "$dir/bin" ]] && [[ -d "$dir/pkg" ]]; then |
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
| +------------+ | |
| | | 2 | | |
| | |--------| | |
| | 1 | 3 |4 | | |
| | |--------| | |
| | | 5 | | |
| +------------+ | |
| +------------+ | |
| | 6 | 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
| module T | |
| TypeError = Class.new(StandardError) | |
| end | |
| class T::Base | |
| attr_reader :types | |
| def initialize(*types) | |
| @types = types | |
| end |
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
| package main | |
| import "os" | |
| func envBool(key string, defaultValue bool) bool { | |
| value, ok := os.LookupEnv(key) | |
| if !ok { | |
| return defaultValue | |
| } | |
| if value == "true" { |
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
| #!/usr/bin/env ruby | |
| # Dependencies: | |
| # - capsh | |
| # - cgroup-utils | |
| # - systemd | |
| # - ruby | |
| # | |
| require 'fileutils' | |
| require 'logger' | |
| require 'optparse' |
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
| module Classy | |
| module Errors | |
| def self.included(base) | |
| base.extend(ClassMethods.clone) | |
| base.private_class_method :error | |
| end | |
| module ClassMethods | |
| def error(name, super_klass = StandardError) | |
| klass_name = name.to_s.split('_').map(&:capitalize).join |
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
| # Basics | |
| module Chef | |
| class Resource | |
| attr_reader :name | |
| def initialize name | |
| @name = name | |
| end |
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
| require 'docopt' | |
| require 'pathname' | |
| require 'set' | |
| USAGE = <<DOCOPT | |
| Julio. | |
| Usage: |
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
| extern crate rustc_serialize; | |
| extern crate docopt; | |
| extern crate glob; | |
| use std::time::Duration; | |
| use std::thread::sleep; | |
| use std::os::unix::fs::MetadataExt; | |
| use std::os::unix::raw::*; | |
| use std::collections::HashMap; | |
| use std::collections::HashSet; |
NewerOlder