This file contains 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 pprint | |
def pad_left(n, width, pad=" "): | |
return ((pad * width) + str(n))[-width:] | |
data = """ | |
SERVER|IP_ADDR|LOCATION|PCN | |
NH-SRV01|10.97.9.30|SUB704|HUB | |
NH-SRV05|10.97.9.34||HUB | |
NH-SRV07|10.97.9.40|SUB501|HUB |
This file contains 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
http://effbot.org/tkinterbook/place.htm |
This file contains 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
Sub Macro3() | |
Dim sht As Excel.Worksheet | |
Dim rge As Excel.Range | |
Dim switch As String | |
Set sht = Excel.Worksheets("SUMMARY") | |
lastRow = sht.Range("B65536").End(xlUp).Row |
This file contains 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
Public Sub DoIt() | |
Dim rge As Excel.Range | |
Dim my_row As Long | |
Set rge = Application.Selection | |
rge.Copy | |
my_row = rge.Row |
This file contains 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
Public Sub test() | |
Dim tbl As Word.Table | |
Dim c As Long | |
Dim n As Long | |
Set tbl = Word.Selection.Tables(1) | |
c = 0 | |
For n = 1 To tbl.Rows.Count |
This file contains 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/ruby | |
%w( yaml pp win32ole ).each { |dep| require dep } | |
class WIN32OLE | |
def self.get_project | |
begin | |
connect('MSProject.Application') | |
rescue WIN32OLERuntimeError => e | |
new('MSProject.Application') | |
end |
This file contains 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
# encoding: UTF-8 | |
%w(pp date).each { |dep| require dep } | |
def weird_date_todate(weird_date) | |
Date.new(weird_date.split(/\./)[2],weird_date.split(/\./)[1],weird_date.split(/\./)[0]) | |
end | |
puts weird_date_todate('14.10.2013') | |
# data = DATA |
This file contains 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
%w(win32ole date time).each { |dep| require dep } | |
def week_ending(tm) | |
# The <?Date> object passed in to week_ending is actually an instance of the Time class | |
new_tm = tm | |
offset = case new_tm.strftime('%a') | |
when "Mon" | |
6 | |
when "Tue" | |
5 |
This file contains 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
print "#{doc}: " | |
print "#{data.size > 1 ? data[0..-2].join(", ") : ""}#{data.size > 1 ? " and " : "" }#{data[-1].join("")}" if data.size > 0 | |
print "None" if data.size == 0 |
This file contains 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
%w(pp win32ole).each { |dep| require dep } | |
db = 'C:\Users\rdapaz\Documents\Statement of Compliance.accdb' | |
cs = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=#{db};" | |
rs = WIN32OLE.new('ADODB.Recordset') | |
conn = WIN32OLE.new('ADODB.Connection') | |
conn.Open(cs) | |
rs.Open("[SoC]", conn, 1, 3) | |
conn.Execute("DELETE * FROM SoC") |
NewerOlder