Skip to content

Instantly share code, notes, and snippets.

Starbeamrainbowlabs sbrl

Block or report user

Report or block sbrl

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@sbrl
sbrl / errorimage.php
Created Oct 22, 2019
[errorimage.php] Generate error images on the fly in portable PHP
View errorimage.php
/**
* Creates an images containing the specified text.
* Useful for sending errors back to the client.
* @package core
* @param string $text The text to include in the image.
* @param int $target_size The target width to aim for when creating
* the image. Not not specified, a value is
* determined automatically.
* @return resource The handle to the generated GD image.
*/
@sbrl
sbrl / JsonStorageBox.php
Last active Sep 21, 2019
[JsonStorageBox.php]
View JsonStorageBox.php
<?php
/*
███████ ████████ ██████ ██████ █████ ██████ ███████ ██████ ██████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██ ██ ██████ ███████ ██ ███ █████ ██████ ██ ██ ███
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██████ ██ ██ ██ ██ ██████ ███████ ██████ ██████ ██ ██
*/
@sbrl
sbrl / StorageBox.php
Last active Sep 21, 2019
[StorageBox.php] A key-value data store, backed by SQLite3.
View StorageBox.php
<?php
/*
███████ ████████ ██████ ██████ █████ ██████ ███████ ██████ ██████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██ ██ ██████ ███████ ██ ███ █████ ██████ ██ ██ ███
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███████ ██ ██████ ██ ██ ██ ██ ██████ ███████ ██████ ██████ ██ ██
*/
View cucumber.js
"use strict";
async function pipe(initial_value, ...funcs) {
let current = initial_value;
for(let func of funcs) {
current = func(current);
// If it's thenable, then it's probably a Promise
if(typeof current.then == "function")
current = await current;
}
@sbrl
sbrl / SvgWriter.mjs
Last active Jun 10, 2019
[SVGWriter.mjs] SVGWriter.cs, ported to Javascript. Uses the xml-writer npm package.
View SvgWriter.mjs
"use strict";
import XMLWriter from 'xml-writer';
import Rectangle from './Rectangle.mjs';
import Vector2 from './Vector2.mjs';
/*
* Simplifies the process for creating an SVG dynamically.
* Originally written for MusicBoxConverter, but lifted, reused, and extended for FloatingIslands.
@sbrl
sbrl / CLI.mjs
Last active Nov 27, 2019
[CLI.mjs] A CLI template for Node.js #template
View CLI.mjs
#!/usr/bin/env node
// Requires Ansi.mjs, which can be found here: https://gist.github.com/8c0bb5e172438b6e62dd48587cfeba84#file-ansi-mjs
import a from './Ansi.mjs';
// 1: Setup
const settings = {
program_name: "",
version: "v0.1",
@sbrl
sbrl / Ansi.mjs
Last active Nov 27, 2019
[Ansi.mjs] VT100 ANSI escape sequence generator in JS. Ported from the C# version.
View Ansi.mjs
"use strict";
/**
* Generates various VT100 ANSI escape sequences.
* Ported from C#.
* @licence MPL-2.0 <https://www.mozilla.org/en-US/MPL/2.0/>
* @source https://gist.github.com/a4edd3204a03f4eedb79785751efb0f3#file-ansi-cs
* @author Starbeamrainbowlabs
* GitHub: @sbrl | Twitter: @SBRLabs | Reddit: u/Starbeamrainbowlabs
***** Changelog *****
@sbrl
sbrl / xsend.py
Last active Jan 7, 2019
[xsend.py] A cleaned-up version of http://xmpppy.sourceforge.net/examples/xsend.py. Requires the "xmpppy" package - which is installable via pip.
View xsend.py
#!/usr/bin/env python3
# $Id: xsend.py,v 1.8 2006/10/06 12:30:42 normanr Exp $
# Edited & cleaned up by Starbeamrainbowlabs <feedback@starbeamrainbowlabs.com>
import sys
import os
import time
import xmpp
@sbrl
sbrl / NightInk.php
Created Dec 5, 2018
[NightInk/PHP] A teeny-tiny templating engine. This implementation is in PHP.
View NightInk.php
<?php
namespace SBRL;
/**
* A teeny-tiny templating engine.
* @author Starbeamrainbowlabs
* @version v0.2
* @lastModified 23rd August 2018
* @license https://www.mozilla.org/en-US/MPL/2.0/ Mozilla Public License 2.0
@sbrl
sbrl / plaintext-convert.sh
Created Nov 26, 2018
Converter for pirate/bookmark-archiver that converts a plain-text list of urls into something it can understand.
View plaintext-convert.sh
#!/bin/bash
set -o errexit
set -o nounset
##############
# This program converts a plain-text list of urls to the
# bookmark-archiver HTML format.
#
# Requirements: curl, xidel
# Usage:
You can’t perform that action at this time.