Hello Bot is a user on mastodon.toycode.com. You can follow them or interact with them if you have an account anywhere in the fediverse. If you don't, you can sign up here.
Hello Bot boosted
Hello Bot boosted

@hello
rgb-tile.c
#include <stdio.h>

void main()
{
int x, y, n=0;
char *c[] = {"#e55", "#5e5", "#55e"};
FILE *fp = fopen("out.svg", "w");

fprintf(fp, "<svg height='200' width='400'>");
for(x=0; x<400; x+=10) {
for(y=0; y<200; y+=10) {
fprintf(fp, "<rect x='%d' y='%d' width='10' height='10' fill='%s' />\n", x, y, c[n++%3]);
}
}
fprintf(fp, "</svg>");
}

Hello Bot boosted

@hello
test.js

function* range(n, end) {
while(n<=end) yield n++;
}

const m = [...range(1,10)];

console.log(m);

Hello Bot boosted

@hello

#!/bin/bash

echo -e "\nbase32"
echo '4OAZHY4CSPRYDK7DQGQ6HANP4S4JNZ4VRQFA====' | tee tmp32
base32 -d tmp32

echo -e "\nbase64"
echo '44GT44KT44Gr44Gh44Gv5LiW55WMCg==' | tee tmp64
base64 -d tmp64

Hello Bot boosted

@hello
hello.sh
mkfifo fifo
awk '{print $1 + 1 }' fifo &
seq 1 10 > fifo

Hello Bot boosted

@hello
repeat.sh
seq 1 10 |
while read n ; do
echo -n "$n "
date
done

Hello Bot boosted
Hello Bot boosted
Hello Bot boosted
Hello Bot boosted

@hello
hello.cpp
#include <iostream>
int main() {
std::cout << "Hello, World!\n";
}

Hello Bot boosted

@hello
hello.cpp
#include <iostream> int main() {
std::cout << "Hello, World!\n";
}

Hello Bot boosted

@hello hello.cpp #include <iostream> int main() { std::cout << "Hello, World!\n"; }

Hello Bot boosted

@hello poc.rb
# A proof of concept of SIGSEGV with Ruby
l = [1].to_enum.with_index.lazy
m = l.map { }

n = m.map { }
n.lazy.to_a

Hello Bot boosted

@hello
test.js

for(let i of [1,2,3])
console.log(typeof i)

for(let i of [1,2,3])
console.log(i)

Hello Bot boosted

@hello
test.js

for(var i in [1,2,3])
console.log(typeof i)

Hello Bot boosted

@hello
aquarium.js

{
// @aquarium を JavaScript でまねっこ
const a=(c,n)=>c.repeat(n);
const p=a=>a[Math.random()*a.length|0];
const f=[...a(' ',180)+a('🐟',6)+a('🐠',6)+a('🐡',4)+'🐬🐙🦈🦐🐋🦑'];
const g=[...a(' ',180)+a('🌿',60)+a('🌱',60)+a('🌾',40)+'🐚🦀🐌🏰💰🐢','⚓️','☘️'];
const s=['',...'   '];
let t='',i,c;
for(i=50;i--;)c=p(f),t+=(c<'、'?'':p(s))+c;
t=[...t].map((c,i)=>i>45?'':(i+1)%10?c:c+'\n').join``+'\n';
for(i=10;i--;)t+=p(g);
console.log(t);
}

Hello Bot boosted
@hello
m.svg
<!DOCTYPE svg [<!ENTITY D "a28,28 0 0 0 0,56 28,28 0 0 0 0,-56z"><!ENTITY E "&D;m0,100&D;m0,100&D;"><!ENTITY F "a80,80 0 0 1 ">]><svg
xmlns="http://www.w3.org/2000/svg" viewBox='0 0 1000 1000'><path
d="M580,562&F;-160,0v-202&F;80,-80h107c-19.071,13.424 -26.187,51.016 -27,73.84zM500,332&E;M141,420&F;160,0v208.16c0.933,22.827 8.049,60.42 27,73.84h-107&F;-80,-80zm80,-26&E;M699,420&F;160,0v202&F;-80,80h-107c19.071,-13.424 26.187,-51.016 27,-73.84zm80,-26&E;"/></svg>
Hello Bot boosted

@hello
aquarium.js

// ちょっとミスあったからもっかい
{
const r=n=>Math.random()*n|0;
const a=(c,n)=>c.repeat(n);
const p=a=>a[r(a.length)];
const f=[...a(' ',180)+a('🐟',6)+a('🐠',6)+a('🐡',4)+'🐬🐙🦈🦐🐋🦑'];
const g=[...a(' ',180)+a('🌿',60)+a('🌱',60)+a('🌾',40)+'🐚🦀🐌🏰💰🐢','⚓️','☘️'];
const s=['',...'   '];
let t='',v,h,c;
for(v=6;v--;)for(h=10+(r(4)*(v==1?-1:1));h--;)
t+=v?(c=p(f),(c<'、'?'':p(s))+c+(h?'':'\n')):p(g);
console.log(t);
}

Hello Bot boosted

@hello
aquarium.js

{
const r=n=>Math.random()*n|0;
const a=(c,n)=>c.repeat(n);
const p=a=>a[r(a.length)];
const f=[...a(' ',180)+a('🐟',6)+a('🐠',6)+a('🐡',4)+'🐬🐙🦈🦐🐋🦑'];
const g=[...a(' ',180)+a('🌿',60)+a('🌱',60)+a('🌾',40)+'🐚🦀🐌🏰💰🐢','⚓️','☘️'];
const s=['',...'   '];
let t='',v,h,c;
for(v=6;v--;)for(h=10+(r(4)*(v<2?-1:1));h--;)
t+=v?(c=p(f),(c<'、'?'':p(s))+c+(h?'':'\n')):p(g);
console.log(t);
}

Hello Bot boosted

@hello
aquarium.py3
from random import *
f=['fish','tropical_fish','blowfish']
fr=['octopus','shrimp','shark','whale2','dolphin']
s=['herb','seedling','ear_of_rice']
sr=['shell','crab','anchor']
def cre(l,lr,rng,lm,p) :
for i in range(rng):
r = randint(1,10)
if r>lm:
print (':'+choice(l)+':',end='')
elif r==1 and i%2==0:
print (':'+choice(lr)+':',end='')
else :
print (p,end='')
if (i-9)%10==0 :
print ('')
cre(f,fr,40,9,' ')
cre(s,sr,10,6,' ')