Skip to content

Instantly share code, notes, and snippets.

View elcontrastador's full-sized avatar

Tyler Arrigoni elcontrastador

View GitHub Profile
[.vim]$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 16 2011 21:20:36)
MacOS X (unix) version
Compiled by [email protected]
Huge version without GUI. Features included (+) or not (-):
+arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent
-clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv -cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
def _syscall_raw(cmd_str)
outputs = Hash.new
Open3.popen3(cmd_str) do |stdin,stdout,stderr,wait_thr|
outputs[:stdout] = stdout.read
outputs[:stderr] = stderr.read
outputs[:pid] = wait_thr.value.pid
outputs[:exitstatus] = wait_thr.value.exitstatus
end
outputs
end
module Linux
module User
def self.syscall(cmd_str,success_retval=nil,dryrun_opts=nil)
return dryrun_opts if dryrun_opts
outputs = Hash.new
Open3.popen3(cmd_str) do |stdin,stdout,stderr,wait_thr|
outputs[:stdout] = stdout.read
outputs[:stderr] = stderr.read
odule Oneif
class UserInfo
# attr_accessor :user_type
def initialize(csv_row,header_hash)
@csv_cols = csv_row.split(',')
@header_hash = header_hash
end
def create_accessors
[net-vty-open_vty (jewler_test)]$ tree
.
├── bin
├── design
├── features
│   ├── step_definitions
│   └── support
├── lib
│   ├── irbloader.rb
│   └── net
module Company
class ClientDirs
attr_reader :template_path, :dest_base_path, :client_domain
#takes Pathname objects as initial params
def initialize(client_template_path, dest_base_path)
@template_path = client_template_path
@dest_base_path = dest_base_path
@client_domain = ""
end
[tenderbak (master)]$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# new file: features/backup_extension.feature
# modified: features/step_definitions/file_extension_steps.rb
# new file: lib/backup.rb
# modified: lib/backup/extension.rb
# modified: spec/backup/extension_spec.rb
Feature: The Backup Extension
When a backup runs, files that require backing up are copied from the working
share to a 'retain' share with a new unique extension appended. It is
necessary for the file to be renamed during the copy to ensure the file is:
* unique so it will not overwrite the existing files or prior version of self
* easily associated with the original and prior backup files
* not dependant on the filesystem mtime/ctime for determining its creation
date and time
* capable of being subsequently parsed back into a ruby Time obj with same
[lib (master)]$ irb
ruby-1.9.2-p180 :001 > require 'ip'
=> true
ruby-1.9.2-p180 :002 > ip = IP.new('10.10.10.10/24')
=> #<IP:0x000001012bde30>
ruby-1.9.2-p180 :003 > ip.to_s
=> "#<IP:0x000001012bde30>"
ruby-1.9.2-p180 :004 > ip.methods
=> [:nil?, :===, :=~, :!~, :eql?, :hash, :<=>, :class, :singleton_class, :clone, :dup, :initialize_dup, :initialize_clone, :taint, :tainted?, :untaint, :untrust, :untrusted?, :trust, :freeze, :frozen?, :to_s, :inspect, :methods, :singleton_methods, :protected_methods, :private_methods, :public_methods, :instance_variables, :instance_variable_get, :instance_variable_set, :instance_variable_defined?, :instance_of?, :kind_of?, :is_a?, :tap, :send, :public_send, :respond_to?, :respond_to_missing?, :extend, :display, :method, :public_method, :define_singleton_method, :__id__, :object_id, :to_enum, :enum_for, :==, :equal?, :!, :!=, :instance_eval, :instance_exec, :__send__]
ruby-1.9.2-p180 :005 > ip.methods.grep(/network/)
mbp-linux*CLI> sip set debug on
SIP Debugging enabled
mbp-linux*CLI>
<--- SIP read from UDP:192.168.1.64:43533 --->
<------------->
mbp-linux*CLI>
<--- SIP read from UDP:192.168.1.64:59247 --->time