Skip to content

Instantly share code, notes, and snippets.

View blackknight36's full-sized avatar
💭
I may be slow to respond.

Michael blackknight36

💭
I may be slow to respond.
View GitHub Profile
def print_arr(ar)
ar.each do |i|
printf("%d ", i)
end
puts
end
#!/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
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
/*
* Array sorting code
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
#!/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
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!"
#!/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
#!/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'
Find IPs in file:
awk '/[0-9]+\.[0-9]+\.[0-9]+\./ {print $1}' var/log/httpd/access.log*
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