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
input_path = "input.txt" | |
output = File.open("output.txt", "w") | |
File.readlines(input_path).each do |line| | |
if(line.include?("testGet")) | |
output.puts line | |
get_method = line[/Get.*\(\)/] | |
get_method[0] = get_method[0].downcase |
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
# Firewall configuration written by system-config-firewall | |
# Manual customization of this file is not recommended. | |
*filter | |
:INPUT ACCEPT [0:0] | |
:FORWARD ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT | |
-A INPUT -p icmp -j ACCEPT | |
-A INPUT -i lo -j ACCEPT | |
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT |
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
select df.tablespace_name "Tablespace", | |
df.file_name "File", | |
df.status "Status", | |
df.autoextensible "Auto Extend?", | |
round((df.bytes / 1073741824), 2) "Used GB", | |
round((df.maxbytes / 1073741824), 2) "Max GB", | |
round(100 * (df.bytes / df.maxbytes), 2) "% Used", | |
round((df.increment_by * (df.bytes / df.blocks)) / 1073741824, 2) "Extent Size GB", | |
round((df.maxbytes - df.bytes) / (df.increment_by * (df.bytes / df.blocks))) "Remaining Extensions", | |
round(pu."pct_used", 2) "% Tablespace Used" |
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
/* View average # of log file switches per hour for a month */ | |
select month "Month", | |
case | |
when month = to_char(sysdate, 'Month') then | |
/* divide by hours since start of the month when looking at current month*/ | |
round(log_switches / (24 * ((to_number(to_char(sysdate, 'dd'))) - 1) + | |
(to_number(to_char(sysdate, 'hh'))) ), 1) | |
else | |
/* otherwise divide by total # hours in month */ | |
round(log_switches / (24 * to_number(to_char(last_day(to_date(month, 'Month')), 'dd'))), 1) |
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/env ruby | |
# encoding: utf-8 | |
input = "a,b,c\nd,e,f\ng,h,i" | |
num_cols = input[0..input.index("\n")].scan(',').count | |
puts input.split("\n").map { |l| l.gsub(/ *, */, ' | ') }.insert(1, '---|' * num_cols + '---') |
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 java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
public class TestListToArrayConversion { | |
public static void main(String[] args) { | |
Map<String, Object> testMap = new HashMap<String, Object>(); |
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/env ruby | |
# encoding: utf-8 | |
ego_level = ARGV[0].to_i | |
if ego_level == 0 | |
puts "You're pretty average." | |
else | |
puts "You are s#{'o' * ego_level.abs} #{ego_level < 0 ? 'un' : ''}cool!!!" | |
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
#!/usr/bin/env bash | |
if [ "$(id -u)" != "0" ]; then | |
echo "This script must be run as root!" | |
exit 1 | |
fi | |
echo "Syncing with NTP server" | |
ntpdate north-america.pool.ntp.org |
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
def find_range(a, str = '') | |
return str[2..-1] if a.empty? | |
start_val = end_val = a[0] | |
a.each do |val| | |
break if val > end_val + 1 | |
end_val = val | |
end | |
if start_val == end_val |
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
def range_and_count_link(network_elements, path, with_link, unique) | |
ranges = generate_name_ranges(network_elements) | |
count = unique ? network_elements.uniq.size : network_elements.size | |
count_str = with_link && count > 0 ? link_to(count, path) : count.to_s | |
"#{ranges} (#{count_str})".html_safe | |
end | |
def range_and_count(network_element, element_to_count, with_link = true, unique = false) | |
poly_route = with_link ? [network_element, element_to_count] : network_element | |
range_and_count_link(network_element.send(element_to_count), polymorphic_url(poly_route), with_link, unique) |
OlderNewer