Skip to content

Instantly share code, notes, and snippets.

View elcontrastador's full-sized avatar

Tyler Arrigoni elcontrastador

View GitHub Profile
[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
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
[net-vty-open_vty (jewler_test)]$ tree
.
├── bin
├── design
├── features
│   ├── step_definitions
│   └── support
├── lib
│   ├── irbloader.rb
│   └── net
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
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
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
[.vim]$ vim --version
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Sep 16 2011 21:20:36)
MacOS X (unix) version
Compiled by tyler@redii-mbpro.local
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 self.change_passwd(login,passwd)
outputs = Hash.new
#$expect_verbose = true
PTY.spawn("/usr/bin/passwd #{login}") do |gdb_out,gdb_in,pid|
gdb_out.expect(/^Enter new UNIX password: /,1) do |r|
gdb_in.printf("#{passwd}\n")
end
gdb_out.expect(/^Retype new UNIX password: /,1) do |r|
gdb_in.printf("#{passwd}\n")
def self.passwd(login,passwd)
outputs = Hash.new
#$expect_verbose = true
PTY.spawn("/usr/bin/passwd #{login}") do |gdb_out,gdb_in,pid|
gdb_out.expect(/^Enter new UNIX password: /,1) do |r|
gdb_in.printf("#{passwd}\n")
end
gdb_out.expect(/^Retype new UNIX password: /,1) do |r|
gdb_in.printf("#{passwd}\n")
def self.passwd(login,passwd)
outputs = Hash.new
#$expect_verbose = true
PTY.spawn("/usr/bin/passwd #{login}") do |gdb_out,gdb_in,pid|
gdb_out.expect(/^Enter new UNIX password: /,1) do |r|
gdb_in.printf("#{passwd}\n")
end
gdb_out.expect(/^Retype new UNIX password: /,1) do |r|
gdb_in.printf("#{passwd}\n")