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
-- cross platform! Works on unix and windows. Notice ability to run host programs?! | |
accept _usr prompt 'UserName: (app) ' default 'app' | |
accept _pwd prompt 'Password: (&_usr) ' default &_usr hide | |
accept _tns prompt 'TNSalias: (SUE2DEV) ' default 'SUE2DEV' | |
whenever sqlerror exit | |
connect &_usr/&_pwd@&_tns | |
whenever sqlerror continue |
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
declare | |
stringa varchar2(100); | |
cursor cur is | |
select * | |
from user_objects; | |
begin | |
for c in cur loop | |
begin |
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
SET LINESIZE 200 | |
SET PAGESIZE 60 | |
COLUMN FIRST_NAME HEADING 'FIRST NAME' FORMAT A15 WRAP | |
COLUMN LAST_NAME HEADING 'LAST NAME' FORMAT A20 WRAP | |
COLUMN BUSINESS FORMAT A20 WRAP | |
COLUMN PHONE FORMAT A15 WRAP | |
COLUMN EMAIL FORMAT A30 WRAP | |
COLUMN CREATED FORMAT A16 | |
COLUMN MODIFIED FORMAT A16 | |
ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI'; |
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
import re, sys, getopt | |
from collections import deque | |
DEFAULT_STATEMENT_TERMINATOR = ';' | |
OPTION_PATTERN = re.compile('''^--<ScriptOptions (.*)/>''', re.I) | |
TERM_OPTION_PATTERN = re.compile('''^--<ScriptOptions.*statementTerminator="(.*)"/>''', re.I) | |
TERM_OPTION = '''--<ScriptOptions statementTerminator="%s"/>''' | |
LOGGING_PATTERN = re.compile('''(.*)^\s+LOGGING\s*$(.*)''', re.I + re.S + re.M) |
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
update searchable s1 | |
set datasource_guid = datasource_guid || ' @@DUPLICATE@@ ' || searchable_id, | |
published_flag = 'N' | |
where s1.searchable_id > | |
( | |
select min(s2.searchable_id) | |
from searchable s2 | |
where s1.datasource_id = s2.datasource_id | |
and s1.datasource_guid = s2.datasource_guid | |
); |
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 'CSV' | |
class CatgManufacturingMachine | |
attr_accessor :main_class, :catg_class | |
attr_reader :cur_catg | |
# Base state - always reset on blank line | |
class StateLook | |
def blank_line(o) | |
o.reset |
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
#Remove all line comments. Backup may be important... | |
ruby -pi.bak -e '$_.sub!(/^#.*/, "")' /work/test.txt |
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 'rubygems' | |
require 'rexml/document' | |
require 'rexml/streamlistener' | |
include REXML | |
class NaicsSynonymListener | |
include StreamListener | |
def initialize(f) | |
@outfile = File.open(f, 'w') |
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
def big_prime(x) | |
prime = x | |
(2..Math.sqrt(x).to_i).each do |i| | |
break if prime <= i | |
prime /= i while (prime > i && prime % i == 0) | |
end | |
prime | |
end | |
s = Time.new |
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
factors = [] | |
(1..20).each do |x| | |
rem = x | |
factors.each do |f| | |
rem /= f if rem % f == 0 | |
end | |
factors << rem if rem > 1 | |
end | |
puts "The answer is... " + factors.inject(1) {|prod, f| prod *= f}.to_s |
OlderNewer