Skip to content

Instantly share code, notes, and snippets.

View Guevara-chan's full-sized avatar

Victoria Guevara Guevara-chan

View GitHub Profile
@Guevara-chan
Guevara-chan / dust.r
Last active February 5, 2022 16:23
Rebolutionary junk sites URL generation util.
REBOL [Title: "REBOL Dust" Author: "Victoria Guevara" Version: 0.0.1]
def_setup: make object! [
char_pool: "abcdefghijklmnopqrstuvwxyz0123456789"
domains: ['.com '.org '.net]
lim: 5x6
]
cfg_file: %config.cfg
setup: either exists? cfg_file [load cfg_file][save/all cfg_file def_setup def_setup]
random/seed now
@Guevara-chan
Guevara-chan / nDustman.nim
Last active April 24, 2021 13:12
Junk sites URL generation util.
# Get compiled executable there: https://github.com/Guevara-chan/packages/releases/tag/nDustman_0.01
import random, nativesockets, threadpool, parsecfg, strutils, sequtils, terminal
const header = "# nDustman junk sites URL generator v0.01\n# Developed in 2021 by Victoria A. Guevara"
# Basic init.
randomize()
const config_file = "config.ini"
config_file.open(fmAppend).close()
var cfg = config_file.loadConfig()
@Guevara-chan
Guevara-chan / os_clr.nim
Created January 13, 2021 14:34
.NET re-implementation of 'OS' stdlib
import clr
let
core = load "mscorlib"
diag = load "System.Diagnostics.Process"
ipath = @(core.GetType "System.IO.Path")
ifile = @(core.GetType "System.IO.File")
idir = @(core.GetType "System.IO.Directory")
ithrd = @(core.GetType "System.Threading.Thread")
ienv = @(core.GetType "System.Environment")
@Guevara-chan
Guevara-chan / rl_converter.coffee
Last active October 5, 2023 01:45
RayLib h2nim autoconverter
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #
# RayLib h2nim autoconverter v0.05
# Developed in 2*20 by Guevara-chan
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- #
[fs, rl, http] = [require('fs'), require('readline'), require('https')] if process?
#.{ [Procedures]
sanity = (name, undes = /\*/g) ->
name = name.replace(undes, '')
if name in ['type', 'end', 'from', 'div', 'ptr'] then name + 'x' else name
@Guevara-chan
Guevara-chan / |minesweeper|.coffee
Last active July 28, 2018 16:20
Barebone minesweeper core.
# ~>Minesweeper core logic.
# ==Extnesion methods==
Function::getter = (name, proc) -> Object.defineProperty @prototype, name, {get: proc, configurable: true}
Function::setter = (name, proc) -> Object.defineProperty @prototype, name, {set: proc, configurable: true}
Boolean::either = (true_val, false_val = '') -> if @valueOf() then true_val else false_val
#.{ [Classes]
class Cell
shroud = (alert = 0b1111) << 4
bomb = flag = alert # Nibble max.
@Guevara-chan
Guevara-chan / |wireworld|.coffee
Last active July 28, 2018 16:52
Barebone wireworld simulator
#.{ [Classes]
class Cell
@[name] = idx for name, idx in ['void', 'cond', 'head', 'tail']
@cycle: (type, shift) -> (type + shift) %% 4
# -------------------- #
class Automata
# --Methods goes here.
constructor: (@width = 4, @height = 4, @wrap = false) ->
if @clear() and @wrap
@get = (x, y) -> @cells[y %% @height][x %% @width]
require('clr').init parms =
assemblies: ['System', 'mscorlib', 'PresentationFramework', 'Microsoft.VisualBasic', 'WindowsBase']
#- Requires node-clr v0.0.17+ to work correctly.
Δimport = (namespace) -> Object.assign global, namespace
Δexport = (entity) -> module.exports[entity.name] = entity
repack = (array) -> array.GetValue idx for idx in [0...array.Length]
Function::getter = (name, proc) -> Object.defineProperty @prototype, name, {get: proc, configurable: true}
Function::setter = (name, proc) -> Object.defineProperty @prototype, name, {set: proc, configurable: true}
Function::new_branch = (name, body) -> @getter name, -> new BranchProxy @, body
BranchProxy = (root, body) ->
EventEmitter = require('events')
require('clr').init {assemblies: ['CSCore.dll', 'System', 'mscorlib']}
Δimport = (namespace) -> Object.assign global, namespace
Δexport = (entity) -> module.exports[entity.name] = entity
Function::getter = (name, proc) -> Object.defineProperty @prototype, name, {get: proc, configurable: true}
Function::setter = (name, proc) -> Object.defineProperty @prototype, name, {set: proc, configurable: true}
#- Requires CSCore v.1.2.0+ (https://github.com/filoe/cscore)
Δimport CSCore
Δimport CSCore.Codecs
Δimport CSCore.SoundOut
conv = require 'iconv-lite'
# ~/Generic patcher proc/~
patch866 = (proc, args...) ->
decoder_tmp = (encoding = 'utf8', start, end) ->
Δ866 iconv.decode, new Buffer(@, start, end), encoding
proc_swap = () ->
[Buffer.prototype.toString, decoder_tmp] = [decoder_tmp, Buffer.prototype.toString]
Δ866 = (proc, args...) ->
[proc_swap(), proc(args...), proc_swap()][1]
# Yet another clone of http://www.text-image.com/convert/
Jimp = require('jimp')
class ascii_image
constructor: (@image, @width = 130, char_pool = "01", filters = [], random_chars = true) ->
# Bitmap downscaling.
@height = Math.max(@image.bitmap.height // (@image.bitmap.width / @width * 2.33), 1)
@image.resize(@width, @height)
# Additinal filtering.
for cmd in filters