Skip to content

Instantly share code, notes, and snippets.

require "open-uri"
require "net/http"
require "openssl"
@page = "unloaded"
@html = "unloaded"
uri = URI.parse(ARGV[0] || 'https://en.wikipedia.org/wiki/Hydrogen')
http = Net::HTTP.new(uri.host, uri.port)
if uri.scheme == "https" # enable SSL/TLS
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
@thomasjslone
thomasjslone / ossy.rb
Created November 25, 2017 19:40
ossy 1404
## Ossy Core - Version 1.4.0.0
## OCT21-2017 - Thomas J. Slone
CORE_VERSION = "1.4.0.3" ; CORE_DATE = "2017.11.22.10.40.21"
CORE_AUTHOR = "Thomas J. Slone" ; CORE_MANUFACTURER = "Tomtech"
CORE_NAME = "Ossy" ; CORE_EDITION = " Another edition. "
CORE_INIT_TIME = Time.now ; CORE_BOOT_LOG = []
MAIN = self
ADMIN = "admin" ; PASSWORD = ""
@thomasjslone
thomasjslone / web_crawler.rb
Created May 5, 2021 03:53
basic blind ruby webcrawler with search terms
# webcrawler 1.0 created 2021.05.04 ## follow the term across every connected link blindly
require 'uri';require 'open-uri'
class Web_Crawler
def initialize
@case_sensitivity=false
end
def crawl(base_page,term)
@counter=0 ##number of loops executed\pages crawled
@search_term=term.to_s ## a string to search pages for
@thomasjslone
thomasjslone / web_crawler1.1.rb
Last active April 18, 2022 14:39
webcrawler vers 1
# webcrawler 1.1 created 2021.05.04 last updated 2021.05.05 j.thomas
# starts with a basepage and grabs links as it finds them in each page while noting instances of search term appearences in pages and links
require 'uri';require 'open-uri'
class Web_Crawler
def initialize
@case_sensitivity=false ## wether caps is ignored when looking for search term
@counter=0 ##number of loops executed\pages crawled
@invalid_counter=0 ## number of invalid pages checked
@already_searched=[] ## links to not crawl again
@search_term=''
## all 256 ascii characters
CHARS = [] ; c = 0 ; 256.times{ CHARS << c.chr.to_s ; c += 1 }
## every 8 bit binary number in order
BINARY = [] ; c = 0 ; 256.times { b = c.to_s(2) ; until b.to_s.length == 8 ; b = "0" + b.to_s ; end ; BINARY << b ; c += 1 }
## every hexicdeimal number in order upto 256 ordinals
HEX = [] ; c = 0 ; 256.times { h = c.to_s(16) ; if h.length == 1 ; h = "0" + h.to_s ; end ; HEX << h ; c += 1 }
## a list of all 8 bit byte codes for the ascii characters
BYTES = [] ; HEX.each do |h| ; BYTES << "\\x" + h ; end
def only_letters? s ;s.upcase.delete("ABCDEFGHIJKLMNOPQRSTUVWXYZ").empty?;end
@thomasjslone
thomasjslone / Prime - Python vs. Ruby
Created September 4, 2021 10:47
The ruby prime method converted to python.
#
# Python
#
def prime(num):
rv=True;c=1;l=num-1
while c<l:
c=c+1
if int(str(num/c).split('.')[-1])==0:
rv=False;c=num
return rv
@thomasjslone
thomasjslone / Exponate - Ruby vs. Python ##BUG
Last active November 6, 2021 21:57
ya there be bugs in there
##
## Python
##
def exp(n):
c=2
e=2
rv=False
while c<=n:
e=2
## to_b methods dependant on ossy string class
class Dex
def initialize
## create data folder if it doesnt exist
@data_path=HOMEDIR+"/app/dex/data"
if File.exist?(@data_path)==false
Dir.mkdir(HOMEDIR+"/app/dex/data")
end
@bankfile=0
if File.exist?(@data_path+"/"[email protected]_s+".db")==false
current_update 2021.11.6.7.2
A bunch of ruby code i use to write
more complex ruby apps
more info and classes are being added all the time with the last major version change being september 2021 now at 7.2
version rollover soon!!! (less than 2 weeks now, so much is about to be fixed with dir and file, im releasing an encoder too)
next:
shadow cert
gem manager
@thomasjslone
thomasjslone / rubin.rb
Created November 5, 2021 21:57
forgot to include this with sys rubin
## rubin entry point is the rubin sys class file right now
## but could become this file in the future
##this file should never be anything more than a shortcut
## shortcuts to this file can have their own window config
load Dir.getwd.to_s+'/sys/rubin.rb'