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 splice(b,e) | |
ilist = [] | |
if b.is_a?(String) == false or e.is_a?(String) == false; raise "Arguements require String type." | |
elsif b.to_s=="" or e.to_s == ""; raise "Arguements cannot be nilstring." | |
end | |
s=self ## self inside the loop will not be the string | |
if s.length<=(b.to_s.length+e.to_s.length); raise "Base string is too small."; end | |
pos=0; stack = false; list=[] | |
if b.length > e.length ; buffer_length = b.length; else; buffer_length = e.length; end | |
buffer = []; buffer_length.times{ buffer << "" } |
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
####################################################### | |
# | |
# demo-ruboto-irb.rb (by Scott Moyer) | |
# | |
# This demo duplicates the functionality of | |
# Ruboto IRB (written in Java) with a ruboto | |
# script (written in Ruby). | |
# | |
####################################################### |
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
VERSION='1.0.30' | |
## RubinSystem is a ruby app runtime environment. Multi-Instance, bot controller on Mingw Windows Ruby | |
## ## !! WARNING !! If you did not download this script from github or the official website, DO NOT RUN IT! | |
## Run this script to install Rubin System, either select the work directory or enter an install location. | |
## After installing run "launch.rb" and you will get the system shell by default. The shell runs input as | |
## ruby script on the RubinSystem context. Precede a command with * if you are entering windows scripts | |
## or host commands, also *context=MAIN changes shell context. The shell does not handle stack errors well | |
## so IRB is used to catch error messages that crash the shell. | |
## | |
## Upon first use, you will get a default system config, use SYSTEM.config? to see what config settings |
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 splice(s,b,e) | |
if b.is_a?(String) == false or e.is_a?(String) == false; raise "Arguements require String type." | |
elsif b.to_s=="" or e.to_s == ""; raise "Arguements cannot be nilstring." | |
end | |
if s.length<=(b.to_s.length+e.to_s.length); raise "Base string is too small."; end | |
pos=0; stack = 0; list=[] | |
if b.length > e.length ; buffer_length = b.length; else; buffer_length = e.length; end | |
buffer = []; buffer_length.times{ buffer << "" } | |
empty_buffer=[]; buffer_length.times{ empty_buffer << "" } ## again, in the loop we can only refer to vars | |
empty_buffer2=[]; buffer_length.times{ empty_buffer2 << "" } ## im really not sure why but id love to know |
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 splice(b,e) | |
if b.is_a?(String) == false or e.is_a?(String) == false; raise "Arguements require String type." | |
elsif b.to_s=="" or e.to_s == ""; raise "Arguements cannot be nilstring." | |
end | |
s=self ## self inside the loop will not be the string | |
if s.length<=(b.to_s.length+e.to_s.length); raise "Base string is too small."; end | |
pos=0; stack = false; list=[] | |
if b.length > e.length ; buffer_length = b.length; else; buffer_length = e.length; end | |
buffer = []; buffer_length.times{ buffer << "" } | |
empty_buffer=[]; buffer_length.times{ empty_buffer << "" } ## again, in the loop we can only refer to vars |
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 'openssl' | |
class Password | |
def initialize(string, seed) | |
@seed = seed | |
cipher = OpenSSL::Cipher.new('AES-256-CBC') | |
cipher.encrypt | |
cipher.key = Digest::SHA256.digest(@seed) | |
@password = cipher.update(string) + cipher.final | |
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
Time.class.class.class_eval{ | |
def parse_seconds(s) | |
s = s.to_i | |
if s < 60 ; [0, 0, s] | |
elsif s < 3600 ; [0, s / 60, s % 60] | |
elsif s < 86400 ; [s / 3600, (s / 60) % 60, s % 60] | |
else | |
days = s / 86400 | |
hours = (s / 3600) % 24 |
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 parse_array *args | |
if args.length > 0 ; str = args[0] ; else ; str = self ; end | |
if str.to_s == "[]"; return []; end | |
str = str.strip.gsub(/^\[|\]$/, '') | |
elements = []; current_element = ''; nested_level = 0 | |
str.each_char do |c| | |
if c == ',' && nested_level == 0 | |
elements << current_element.strip | |
current_element = '' | |
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
def generate_certificate(filepath) | |
file_size = File.size(filepath) # Get the size of the file | |
total = file_size # Iterate over every byte of the file and add its value to the size | |
File.open(filepath, "rb") do |file| | |
while byte = file.read(1) | |
total += byte.unpack('C').first | |
end | |
end | |
certificate = total.to_f / file_size # Divide the total by the size of the file to create the certificate | |
return certificate.to_s |
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
VERSION='1.0.30' | |
## RubinSystem is a ruby app system enviornment. | |
## | |
## Run this script to install Rubin System. | |
## Either select the directory or enter an install location. | |
## After installing run "launch.rb" and you will get the system shell by default. The shell runs input as | |
## ruby script on the RubinSystem context. Precede a command with * if you are entering windows scripts | |
## or host commands, also *context=MAIN changes shell context. The shell does not handle stack errors well | |
## so IRB is used to catch error messages that crash the shell. |