Skip to content

Instantly share code, notes, and snippets.

@stenno
stenno / help.md
Last active October 13, 2021 11:38
##jsgolf starter/help text

##jsgolf is a channel on the IRC network Libera. Using an IRC client is recommended, but you can also use the web-based client. In order to participate, you need to register your nickname on Libera. Follow these instructions to register and identify.

The bot nibblrjr will handle all commands and submissions related to code golfing (and more!):

Command Explanation
~golf.tasks list all currently active golfing tasks
~golf.task <task> print the description of task <task>
~golf.scores list the current score for all tasks you are participating in
~golf.scores __ list the top 5 scores for task __
@stenno
stenno / jsgolf.md
Created April 27, 2019 23:46
announcing ##jsgolf

Hey, we are currently building a code golfing community on the Freenode IRC network. At the moment we are around 25 hackers, and invite everyone to join us in the quest to find the shortest possible code for a given task. For example, the task of writing a function to convert a hex color (#FFFFFF) or (#FFF) to rgb (rgb(255,255,255)) is currently solved using 60 characters.

If you are interested in learning about code golfing, or feel like challenging the pros, fire up your favorite IRC client or use the web client and join the ##jsgolf channel on Freenode. For an overview of the current tasks, you can also visit nibblr.pw and enter 'golf' in the 'search command' input.

@stenno
stenno / senderror.php
Created April 26, 2019 09:39
php send error
public function sendError($message, $code) {
http_response_code($code);
echo 'TEST';
exit;
}
@stenno
stenno / demo.js
Created April 25, 2019 14:19
.then vs async/await
// .then - creates new scope and nesting level
fetch(url).then(result => {
doStuff(result);
doOtherThings;
doAlotOfOTherThings;
doMoreThings;
doEvenMoreThings;
});
@stenno
stenno / startscum.js
Last active April 19, 2019 21:44
Startscumming with nodehack (untested)
const { NethackSession } = require('../nodehack');
// const startscumItems = require('./startscum_items');
const username = 'username';
const password = 'password';
const MAX_TRIES = 10;
const TIMEOUT = 10000;
const startscumItems = { items: ['ring of slow digestion', 'spellbook of identify'] };
@stenno
stenno / tiledataMapping.txt
Created March 3, 2019 13:08
nethack tiledata mapping
Worn items on inventory page 1 of 2
[ 'a blessed +3 small shield (being worn)' ]
Player strength: 16
Status warnings: Hungry
Current turncount: 830
-------
|..{.<| -------
....%..# ......|
@stenno
stenno / botlParsing.txt
Created February 24, 2019 14:17
Parsing botl with nodehack
got status bar Nodehack the Stripling St:16 Dx:13 Co:17 In:8 Wi:13 Ch:8 Lawful lvl:2 $:15 HP:23(23) Pw:5(5) AC:6 Xp:2 T:815 Hungry Burdened
{ title: 'Stripling',
attributes:
{ strength: '16',
dexterity: '13',
constitution: '17',
intelligence: '8',
wisdom: '13',
charisma: '8' },
alignment: 'Lawful',
@stenno
stenno / tiledata.js
Created February 16, 2019 14:08
vt_tiledata returned from HDF-3.6.2
tiledata got [ 1, 2, 3 ] z { col: 73, row: 4 }
tiledata got [ 1, 2, 1 ] z { col: 73, row: 4 }
tiledata got [ 1, 2, 3 ] z { col: 0, row: 0 }
tiledata got [ 1, 2, 1 ] z { col: 73, row: 4 }
tiledata got [ 1, 2, 0 ] z { col: 0, row: 0 }
tiledata got [ 1, 3 ] z { col: 39, row: 0 }
@stenno
stenno / asyncExample.js
Created February 11, 2019 23:09
async generator example
async doANSIInput(data) {
this.session.prepareForInput();
const terminal = await this.session.rawInput(data, WAITING_DELAY);
const ANSIWindow = terminal.getANSICells();
return ANSIWindow;
}
async* batchANSIInput(commands) {
@stenno
stenno / playground.js
Last active February 10, 2019 16:17
Nethack API Frontend WIP
const NethackAPI = require("./nethackapi");
const nethackAPI = new NethackAPI();
// lazy top-level await
(async () => {
// connect to HDF
await nethackAPI.loginSSH("stenno", "not my password", "nethack@eu.hardfought.org");