This was quite painful, so I'm writing it down for next time.
- Create a private key.
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
- Get the public key
// @ts-check | |
/** | |
* @typedef Server | |
* @property {string} name | |
* @property {string} link | |
* @property {string} owner | |
* @property {boolean?} expert | |
* @property {'Survival' | 'Custom'} type | |
* @property {'cloud' | 'mac'} host |
#ifndef TABLE_OUTPUT_H | |
#define TABLE_OUTPUT_H | |
#include <iostream> | |
#include <iomanip> | |
// Helper to output tabular data without repeating calculations everywhere. | |
template<unsigned TSize> | |
class TableOutput { | |
public: |
import { EventEmitter } from "events"; | |
import { on } from "cluster"; | |
export interface PlainAddress { | |
address: string | number | |
port: string | number | |
} | |
export class Address { | |
constructor(address: Address | PlainAddress) |
// Emoji list taken from emojis npm package | |
(function (global, factory) { | |
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('@bhmb/bot')) : | |
typeof define === 'function' && define.amd ? define(['@bhmb/bot'], factory) : | |
(factory(global['@bhmb/bot'])); | |
}(this, (function (bot) { 'use strict'; | |
const MessageBot = bot.MessageBot | |
const emojis = { |
This was quite painful, so I'm writing it down for next time.
openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem
--[[ | |
Splits a string `source` by `delim`. If `delim` is not specified, will split `source` by whitespace. | |
Pass a truthy value for `pattern` to allow patterns to be used when splitting the string. | |
Returns a table with all values. | |
]]-- | |
function split(source, delim, pattern) | |
if not delim then delim, pattern = '%s+', true end | |
local result = {} | |
local search_start = 1 | |
while true do |
window['@bhmb/bot'].MessageBot.registerExtension('bibliofile/scroll-down', ex => { | |
console.log('Will always scroll down') | |
const list = document.querySelector('#console .chat') | |
const observer = new MutationObserver(() => { | |
setTimeout(() => list.scrollTop = list.scrollHeight, 100) | |
}) | |
observer.observe(list, { childList: true, subtree: true }) | |
ex.remove = () => observer.disconnect() |
# Paste this into https://omrelli.ug/nearley-playground/ | |
main -> expression {% id %} | |
expression -> | |
mult_term {% id %} | |
| expression _ ("+"|"-") _ mult_term {% d => d[2][0] === '+' ? d[0] + d[4] : d[0] - d[4] %} | |
mult_term -> | |
exp_term {% id %} |
(function(global, factory) { | |
typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('@bhmb/bot')) : | |
typeof define === 'function' && define.amd ? define(['@bhmb/bot'], factory) : | |
(factory(global['@bhmb/bot'])); | |
}(this, (function(bot) { | |
'use strict'; | |
const MessageBot = bot.MessageBot | |
function random(max) { | |
return Math.floor(Math.random() * max) + 1; |