Skip to content

Instantly share code, notes, and snippets.

View drkameleon's full-sized avatar
🏠
Working from home

Yanis Zafirópulos drkameleon

🏠
Working from home
View GitHub Profile
@drkameleon
drkameleon / dictio.art
Last active October 6, 2023 09:02
Dictionary-ish example in Grafito
#!/usr/bin/env arturo
do {grafito.art}
do [
lemma: function [wrd, lng, ps][
f: form.new.unique [name: wrd]
res: word #[
lang: to :string lng,
pos: to :string ps,
@drkameleon
drkameleon / trial.dat.json
Created April 6, 2023 08:36
Trial.dat contents
{
"nand": 2,
"clamp": 2,
"info": 1,
"fdiv": 2,
"atanh": 1,
"regex?": 1,
"move": 2,
"all?": 1,
"first": 1,
@drkameleon
drkameleon / lib.files.res
Created March 1, 2023 15:32
Updated lib.files output (macOS)
Created: temp/
>> copy
copy is working well!
>> copy.directory - with empty folders
copy empty directory is working well!
@drkameleon
drkameleon / lib.files.res
Created February 28, 2023 10:45
Generated output after running `arturo tests/unittests/lib.files.art`
Created: temp/
>> copy
Hello, world!
>> copy.directory - with empty folders
temp/dest/file.txt
@drkameleon
drkameleon / testsorting.art
Created January 10, 2023 16:33
Test sorting (in effect, test that sorting a Block and a Dictionary yields the same results; either in terms of the expected keys, or values)
labels: ["a", "b", "c", "d", "e", "f", "g", "h"]
items: ["uno", "dos", "tres", "Uno", "perversión", "ábaco", "abismo", "aberración"]
dic: function []-> #.raw flatten @[couple labels items]
revdic: function []-> #.raw flatten @[couple items labels]
verify: function [what][
toDo: [sort] ++ what
bl: do toDo ++ [items]
@drkameleon
drkameleon / rc-tasks.art
Last active December 2, 2022 17:32
RC Tasks (@RickBarretto) in Arturo
RC: "https://rosettacode.org"
GreenLine: color #green repeat "=" 50
sanitizeUrl: function [url]-> replace replace url "pagefrom=" "" "%27" "'"
filterLines: function [lines, pattern]-> select lines 'line [contains? line pattern]
getNextPageUrl: function [lines][
loop filterLines lines {next page</a>} 'line [
return sanitizeUrl first match line {/pagefrom=(.+)#mw-pages/}
]
@drkameleon
drkameleon / testdicts.art
Created October 28, 2022 16:19
Create 120k+ dictionaries
This file has been truncated, but you can view the full file.
a: #[name: "John", surname: "Doe"]
b: #[name: "Jane", surname: "Doe", address: #[country: "Spain", city: "Madrid"]]
c: #[name: "Bill", age: 36]
a: #[name: "John", surname: "Doe"]
b: #[name: "Jane", surname: "Doe", address: #[country: "Spain", city: "Madrid"]]
c: #[name: "Bill", age: 36]
a: #[name: "John", surname: "Doe"]
b: #[name: "Jane", surname: "Doe", address: #[country: "Spain", city: "Madrid"]]
c: #[name: "Bill", age: 36]
a: #[name: "John", surname: "Doe"]
@drkameleon
drkameleon / bf1.art
Created October 21, 2020 10:20
BF interpreter in Arturo
print ---
=========================
Brainf*ck compiler
In Arturo
=========================
---
tape: [0]
jumps: #[]
dataPointer: 0
@drkameleon
drkameleon / bf2.art
Created October 21, 2020 10:16
BF to Arturo transpiler
memSize: 100
interpret: function [code][
m: map 0..memSize []->0
p: 0
continue: true
replace 'code "," "set m p input ------ "
replace 'code ">" "inc 'p "
replace 'code "<" "dec 'p "
replace 'code "+" "set m p (get m p)+1 "
@drkameleon
drkameleon / autounfollow.js
Created August 24, 2015 10:47
Automatically Unfollow those who are not following back
// To be copy-pasted in the "Following" Twitter page
var profiles = $(".ProfileCard.js-actionable-user");
for (var i=0; i<profiles.length; i++) {
var p = profiles[i];
var status = $($(p).find(".FollowStatus")[0]).text().trim();
var button = $(p).find(".user-actions-follow-button");
if (status!="follows you") $(button).trigger('click');
}