Skip to content

Instantly share code, notes, and snippets.

@thomasjslone
thomasjslone / vdr 3.0
Last active January 28, 2017 02:23
vdr with storrage/access modes seperate, multidisk virtual file system w/ encryption and importing/exporting to real file system
class VDrive
## V1.2.2
## Methods:
## - file_exist?(STRING) path returns boolean
## - folder_exist?(STRING) path returns boolean
## - ftype?(STRING) path returns "FILE" , "FOLDER" , "CORRUPTED OBJ"
## - read_file(STRING) path returns string contained in file
## - write_file(STRING,STRING) path, content returns string written, if file does not exist it will be created, otherwise it will be overwritten
## - copy_file(STRING,STRING) path, newpath returns true
## - create_folder(STRING) path returns true
## NAME: ossy V1.3
## RELEASE: @ 2017.1.27 by TTF INC.
def map_dir(dir) # return an array of two arrays, file and folder paths of every file in given directory and every subdirectory and file with in it
if File.directory?(dir) ; remaining = [dir] ; found_files = [] ; file_size = [] ; found_folders = [] ; until remaining.length == 0 ; cur_dir = remaining[0].to_s ; remaining.delete_at(0) ; cont = Dir.entries(cur_dir) ; cont.delete(".") ; cont.delete("..") ; cont.each do |obj| ; if File.file?(cur_dir.to_s + "/" + obj.to_s) ; found_files << cur_dir.to_s + "/" + obj.to_s ; file_size << File.size?(found_files[-1]) ; elsif File.directory?(cur_dir.to_s + "/" + obj.to_s) ; found_folders << cur_dir.to_s + "/" + obj.to_s ; remaining << cur_dir.to_s + "/" + obj.to_s ; end ; end ; end ; return [file_size,found_files,found_folders] ; else ; "Invalid Directory: " + dir.to_s ; end
end
def splice(str,b,e) #get the point between the first pair instance of tags from the given st
class Simpleton_Cipher
def initialize ; @chset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789,./;'[]-=<>?:\"{}_+)(|\\*&^%$#@!~` \n" ; end
def generate_key ; key = @chset ; key = key.split('').shuffle.join('').to_s ; key ; end
def encode(str,key) ; str.tr(@chset, key) ; end
def decode(str,key) ; str.tr(key, @chset) ; end
end
@thomasjslone
thomasjslone / bot.rb
Last active February 21, 2017 06:31
better ruby bot model
# @qued = [] @timestamped = [] @threads = [] @done = [] @log = []
#
# - run
# - stop
# - running?
# - state?
# - schedual_task
# - unschedual_task
# - que_task
# - que_file
@thomasjslone
thomasjslone / ossy v1.0.4
Last active February 21, 2017 04:09
Ruby Development Runtime/Debug Environment
#T#;#O#;#P#;#F#
require "rbconfig"
module AddExec ; def exec(r) ; begin ; eval(r.to_s) ; rescue => e ; e.backtrace.join("\n").to_s ; end ; end ; end
OS = "UNKNOWN" ; if RbConfig::CONFIG["host_os"] == "linux" and RbConfig::CONFIG["host_vendor"] == "The Android Project" ; OS = "ANDROID" ; elsif RbConfig::CONFIG["host_os"] == "mingw32" or RbConfig::CONFIG["host_os"] == "mingw64" ; OS = "WINDOWS" ; end
if OS == "ANDROID"
SYS_DIR = ENV["ANDROID_ROOT"].to_s
elsif OS == "WINDOWS"
SYS_DIR == Dir.home.to_s
else
SYS_DIR = Dir.getwd.to_s
@thomasjslone
thomasjslone / rom_game.rb
Last active February 21, 2017 20:04
Venture Engine, choose your own adventure, novel based game engine for ruboto on android
$rom_header = ["Game Title",
"0.0.0",
"Author : Full Name",
"Rpg/Adventure/TextBased",
"Janurary 2017",
"XXCID-001CY-X86-USA",
]
@var="helloworld"
def save_file ; ; end
def load_file ; ; end
## Name: Dictionary
## Version: 1.1.1
## Release: 2017-4-9
## Manufacturer: Thomas Tech
class Dictionary
def initialize
@dex = []
@data = [] # there can be arrays stored here containing descriptions, part of speech and any aditional entry info, add save/load support later
## Name: Ruby Bot
## Version: 2.0.2
## Release: 2017-3-29
## Manufacturer: Thomas Tech
class Bot
def initialize(auto)
@todo, @doing, @done, @failed, @log = [], [], [], [], []
@run, @main = false, nil
@cycles, @delay = 0, 0.0
## Name: Rios Methods
## Version: 1.0.6
## Release: 2017-1-5
## Manufacturer: Thomas Tech
def splice(str,b,e)
res = []
loop do
p = str[/#{b}(.*?)#{e}/m, 1].to_s
if p.to_s.length == 0
@thomasjslone
thomasjslone / dictionary.dex
Created April 14, 2017 11:11
data file for dictionary v 1.1.1
["a", "aalar", "aaron", "aaronite", "aaronites", "aasbai", "abacuc", "abaddon", "abadias", "abagtha", "abana", "abanah", "abandon", "abandoned", "abandonment", "abaran", "abarim", "abaron", "abase", "abased", "abasement", "abases", "abaseth", "abashed", "abasing", "abate", "abated", "abatement", "abateth", "abba", "abda", "abdeel", "abdemelech", "abdenago", "abdi", "abdias", "abdiel", "abdon", "abed", "abel", "abela", "abelcheramim", "abeldomum", "abelmahula", "abelmaim", "abelmehula", "abelmeula", "abenboen", "abes", "abesalom", "abesan", "abessalom", "abez", "abgatha", "abhor", "abhorred", "abhorrence", "abhorrest", "abhorreth", "abhorring", "abi", "abia", "abiah", "abialbon", "abiam", "abiasaph", "abiathar", "abib", "abida", "abidah", "abidan", "abide", "abides", "abidest", "abideth", "abiding", "abiel", "abiezer", "abiezrite", "abiezrites", "abigabaon", "abigail", "abigal", "abihaiel", "abihail", "abihu", "abihud", "abijah", "abijam", "abilene", "abilina", "ability", "abimael", "abimelech", "abinadab", "a