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 print_arr(ar) | |
ar.each do |i| | |
printf("%d ", i) | |
end | |
puts | |
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
#!/usr/bin/ruby | |
def merge(a, l, r) | |
nl = l.length | |
nr = r.length | |
i, j, k = [0]*3 | |
while i < nl and j < nr | |
if l[i] <= r[j] | |
a[k] = l[i] | |
i += 1 | |
else |
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
#include <math.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include <limits.h> | |
#include <stdbool.h> | |
/* | |
* Array sorting code |
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 print_arr(ar) | |
ar.each do |i| | |
printf("%d ", i) | |
end | |
puts | |
end | |
def insertionSort(a) | |
n = a.length - 1 | |
for i in (1..n) do |
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
#!/usr/bin/env ruby | |
def print_arr(ar) | |
ar.each do |i| | |
printf("%d ", i) | |
end | |
puts | |
end | |
def bubble_sort(a) | |
n = a.length |
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
class Person | |
attr_accessor :age | |
def initialize(initialAge) | |
@age = initialAge | |
if @age < 0 then | |
puts "Age is not valid, setting age to 0." | |
@age = 0 | |
elsif @age > 30 then | |
puts "You are too old!" |
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
#!/usr/bin/env ruby | |
def fiboMod (t1, t2, n) | |
n = n-1 | |
if n == 1 | |
return t2 | |
else | |
return fiboMod(t2, t2**2 + t1, n) | |
end | |
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
#!/usr/bin/env ruby | |
def check_server(url) | |
@output = %x(httping -c 1 -s -l -m #{url}).split() | |
return @output[-1].to_i | |
end | |
server_url = '<%= @start_page %>' | |
lock_file = '/tmp/check_http_lock' |
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
Find IPs in file: | |
awk '/[0-9]+\.[0-9]+\.[0-9]+\./ {print $1}' var/log/httpd/access.log* |
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
Schedule { | |
Name = "FirstWeeklyCycle" | |
Run = Full 1st sat at 03:05 | |
Run = Differential 2nd-5th sat at 03:05 | |
Run = Incremental mon-fri at 03:05 | |
} | |
Schedule { | |
Name = "SecondWeeklyCycle" | |
Run = Differential 1st sat at 03:05 |