start new:
tmux
start new with session name:
tmux new -s myname
| module BinaryTree | |
| class Node | |
| attr_reader :word, :count, :left, :right | |
| include Enumerable | |
| def initialize(word) | |
| @word, @count = word, 1 | |
| end |
| #!/usr/bin/env bash | |
| sudo yum -y update && sudo yum -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev libyaml wget rubygems | |
| cd /tmp | |
| wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz | |
| tar -xvzf ruby-1.9.3-p125.tar.gz | |
| cd ruby-1.9.3-p125/ | |
| ./configure --prefix=/usr/local | |
| sudo make | |
| sudo make install | |
| gem install chef ruby-shadow --no-ri --no-rdoc |
| #!/usr/bin/env bash | |
| apt-get -y update | |
| apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev | |
| cd /tmp | |
| wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz | |
| tar -xvzf ruby-1.9.3-p125.tar.gz | |
| cd ruby-1.9.3-p125/ | |
| ./configure --prefix=/usr/local | |
| make | |
| make install |
| set -g prefix C-a # Make C-a the prefix instead of default | |
| bind C-a send-prefix # Send to application | |
| unbind C-b # Unbind C-b | |
| set -sg escape-time 1 # Remove delay for keystrokes | |
| setw -g mode-keys vi # Use vi mode | |
| ### Mouse mode ### | |
| setw -g mode-mouse on # Toggle mouse mode globally | |
| set -g mouse-select-pane on # Select pane using mouse |
| # MySQL. Versions 4.1 and 5.0 are recommended. | |
| # | |
| # Install the MySQL driver: | |
| # gem install mysql2 | |
| # | |
| # And be sure to use new-style password hashing: | |
| # http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
| development: | |
| adapter: mysql2 | |
| encoding: utf8 |
| ## Like a Symbol#to_proc but for array | |
| class Array | |
| def to_proc | |
| lambda {|object| | |
| self.map{|symbol| object.send(symbol.to_sym)} | |
| } | |
| end | |
| end |
| #!/usr/bin/env ruby | |
| #require 'rubygems' | |
| #require 'pry' | |
| #require 'pp' | |
| # This scripts returns a list of MAC addresses. | |
| # Usage: | |
| # ./$0 LIMIT START END | |
| # ./genmac.rb 5 00:50:56:00:00:00 00:50:56:3F:FF:FF | |
| # |
| string_t = None | |
| def get_rstring(addr): | |
| s = addr.cast(string_t.pointer()) | |
| if s['basic']['flags'] & (1 << 13): | |
| return s['as']['heap']['ptr'].string() | |
| else: | |
| return s['as']['ary'].string() | |
| def get_lineno(iseq, pos): |