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
primes = [2] | |
count = 1 | |
prime_candidate = 2 | |
start = Time.now() | |
until (count == 10001) do | |
prime_candidate +=1 | |
while (true) do | |
psqrt = Math.sqrt(prime_candidate) | |
unless primes. | |
find do |prime| |
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
num = <<NUM | |
73167176531330624919225119674426574742355349194934 | |
96983520312774506326239578318016984801869478851843 | |
85861560789112949495459501737958331952853208805511 | |
12540698747158523863050715693290963295227443043557 | |
66896648950445244523161731856403098711121722383113 | |
62229893423380308135336276614282806444486645238749 | |
30358907296290491560440772390713810515859307960866 | |
70172427121883998797908792274921901699720888093776 | |
65727333001053367881220235421809751254540594752243 |
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
1.upto(100).each do |x| | |
s = "" | |
s+= 'fizz' if (x % 3 == 0) | |
s += 'buzz' if (x % 5 == 0) | |
s = x.to_s if (s.empty?); | |
puts s | |
end |
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
doskey subl="C:\Program Files\Sublime Text 2\sublime_text.exe" $* |
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
walls = [2,5,1,2,3,4,7,7,6] | |
# array of max values of elements to the left for each element | |
def running_max(_walls) | |
maxmin = 0 | |
_walls.inject([]) do |maxes, c| | |
maxes << if (c < maxmin) then | |
maxmin | |
else | |
maxmin = c |
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
' Alt-F11 in Word to get into VBA mode | |
' Then Insert>>Module | |
' Paste this in and Run | |
Public Sub CreateOutline() | |
Dim docOutline As Word.Document | |
Dim docSource As Word.Document | |
Dim rng As Word.Range | |
Dim astrHeadings As Variant |
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
docker rm -vf $(docker ps -a -q) |
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
# | |
# Google interview question: find all combinations that sum up to a value | |
# | |
require 'set' | |
def summables(vector, remainder, so_far) | |
return Set.new if remainder < 0 #did not find a sum | |
return [so_far].to_set if remainder == 0 #found a sum | |
car = vector[0] |
OlderNewer