Skip to content

Instantly share code, notes, and snippets.

@thomasjslone
thomasjslone / auto backup.rb
Last active February 27, 2023 20:23
SemiAuto Backup - Backup files and folders of particular types and names, or just everything
class Auto_Backup
def initialize()
@back_dir = "C:/Users/Jacob/Desktop/"
@dest_dir = "D:/projects/"
@included_formats = [] # if none will include all formats, if not none then includes only listed formats
@included_fnames = [] # if none will include all names, if not none then includes only listed names
@included_dnames = [] # same as above but for directories
@excluded_formats = ["lnk","ini"] # any formats listed here will be excluded before the final backup process
@excluded_fnames = ["consol.bat"] # any files with matching names will be excluded if they were included
@excluded_dnames = [] # excludes directories with matching names if were inlcuded
@thomasjslone
thomasjslone / dictionary.dat
Last active August 10, 2016 21:11
Ruby Virtual Operating System
0.0.0,0.0.0.3,0.0.0.8.0.1.0,0.0.0.24.102.116.121.112.105.115.111.109.0.0.0.0.105.115.111.109,0.0.0.105.110.102.111.105.115.102.116.30.0.0.0.108.109.109.115,0.0.31.4,0.0.100.97.116.97.0,0.1.0,0.2.0,0.2.0.2.0.5.0.6.0.2.0.4.0.3.0.1.0,0.2.0.14.0.4.0.19.0.6.0.15.0,0.3.0,0.3.0.14.0.0.0.14.0.3.0,0.3.0.14.0.5.0,0.3.0.14.0.6.0.18.0,0.4.0,0.4.0.5.0.6.0,0.4.0.14.0.4.0,0.4.0.17.0.6.0,0.5.0,0.5.0.16.0,0.6.0,0.6.0.4.0.4.0,0.6.0.15.0.7.0,0.7.0.17.0.8.0,0.8.0,0.14.0,0.14.0.30.0.8.0,0.15.0,0.16.0,0.17.0.4.0,0.17.0.6.0.17.0.3.0,0.18.0,0.19.0,0.19.0.4.0,0.20.0,0.22.0.8.0.16.0.1.0,0.28.0.6.0.30.0,0.97.0.97.0,0.97.0.101.0,0.98.0,0.98.0.99.0,0.99.0,0.100.0,0.100.0.97.0,0.100.0.108.0.108.0,0.101.0,0.101.0.101.0,0.115.0.116.0.111.0.114.0.97.0.103.0.101.0,0.115.0.121.0.115.0.116.0.101.0.109.0,0.119.0.105.0.110.0.100.0.111.0.119.0.115.0,6.120,15.18.0,19.21.0,19.24.0,21.15.0.29.15.17.0,22.16.0,96.5.114,97,97.97,97.97.114.111.110,97.97.114.111.110.105.116.101.115,97.98,97.98.97.100.100.111.110,97.98.97.103.116.104.97,97.98.97.110.97,97.
@thomasjslone
thomasjslone / r.rb
Last active September 14, 2016 01:40
RBX is now known as Renv
begin
require 'rbconfig'
rescue => exception
raise "Ruby Environment could not start because library is missing. \n" + execption.to_s + "\n" + exception.backtrace.join("\n").to_s
end
@host_os = RbConfig::CONFIG["host_os"].to_s
@prime_numbers = ['3575263','3575269','3575291','3575317','3575333','3575339','3575357','3575371','3575413','3575437','3575441','3575449','3575471','3575483','3575503','3575519','3575521','3575531','3575549','3575573','3575581','3575597','3575599','3575609','3575617','3575639','3575647','3575653','3575657','3575687','3575701','3575707','3575771','3575783','3575821','3575839','3575843','3575849','3575861','3575863','3575867','3575893','3575909','3575911','3575917','3575921','3575927','3575941','3575959','3575981','3575983','3575987','3575993','3576029','3576031','3576037','3576043','3576073','3576091','3576101','3576119','3576121','3576127','3576151','3576163','3576179','3576187','3576217','3576227','3576233','3576257','3576269','3576283','3576289','3576299','3576311','3576319','3576
## Creates a stream array of key press instances, updates 100 times a second, ignores held keys(not totaly working yet)
## This is a pure ruby key listener / logger that works for the consols keyboard context, unfortuanatly not in other contexts
## such as other windows.
##
## Currently a bug is causing every loop to set the current value to lift even if key press is still present
## this bug is in the listen loop and is involved with the onditional branch that is supposed to set lift status
## when a check reveals that no key is being pressed, this will allow the stream to capture individual instances
## of key presses, the current variable represents the current key being pressed and is accurate with in a
## ten-thoudanth of a second, to change this you can tweak the sleep setting.
##
@thomasjslone
thomasjslone / vap.rb
Last active August 7, 2016 20:07
Virtual Abstraction Processor
#
# this was an attempt of making the vap program more efficient and compact
# this processor works almost the same but loops and branches are all one line operations, however there is still clock control and labels because technically
# this is running afc 1.2, an updated version of afc that works the same way.
#
#
#
#
#
@thomasjslone
thomasjslone / windows_shell.rb
Created June 4, 2016 16:37
Windows Shell io loop class is portable and can be used by multiple classes to make consol apps
## this is a Handy Dandy shell class, it controls stdin/out flow allowing your programs
## to pass this class around and start and stop it with ease, I lost my elaborate version of this class so I just wipped this
## one up with haste. Feel free to offer suggestions.
##
## The object that becomes parent here usually has a @api variable, which processes the input to the app, i sometimes call it the
## application input firewall.
##
class Windows_Shell
def initialize(parent)
@parent = parent
@thomasjslone
thomasjslone / consol.bat
Last active June 13, 2016 09:48
RKON - Windows terminal text-based game engine in pure Ruby
irb
@thomasjslone
thomasjslone / downoad_dialog.rb
Created June 9, 2016 17:37
update or write over previously written lines in consol, control caret, carriage
@perc = 0
t = Thread.new { loop do ; @perc += 1 ; sleep 0.15 ; end }
until @perc == 100
puts "Downloading: (" + @perc.to_s + "%)"
print "\r" #carret to beginning of line
print "\e[A" #carret up one line
sleep 0.050
end
puts "Downloading: (100%)"
#print "\r\e[A"
@thomasjslone
thomasjslone / blinker alternate.rb
Created June 11, 2016 18:08
Basic Ruby Terminal Animations, write or print over previously written lines.
@state1 = "O"
@state2 = " "
@canvas = @state1.to_s
@visable = true
@blink = 0.250
blinker = Thread.new { loop do
if @visable
@canvas = @state2.to_s
@visable = false
else
@thomasjslone
thomasjslone / Coder.rb
Last active February 27, 2023 20:19
Coder Basic encoding I pulled out of my ass
class Coder ## basic and somwwhat crude string encoding for text files and program data strings
def initialize
##below is a list of all the characters you can make with a keyboard (excluding windows alt numkey function)
@kbchars = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9","-","+","_","=","[","]","{","}","|","\\","/",":",";",",",".","?","<",">","\"","'","`","~","!","@","#","$","%","^","&","*","(",")","\n","\t"," "]
## if you shuffle the @kbchars variable above, you can make your own encoding keys and pass them to the enc/dec methods
@chbytes = [] ## here we will just convert them to bytes, we want them to all be numbers below 100 and above 0
@kbchars.each { |ch| @chbytes << ch.to_s.bytes[0].to_s } ## there is 97 characters including tabs and line breaks ("\n")
end
def enc(str)
key =