Skip to content

Instantly share code, notes, and snippets.

View tracker1's full-sized avatar

Michael J. Ryan tracker1

View GitHub Profile
@tracker1
tracker1 / .eslintrc.js
Created May 11, 2020 23:07
eslint-prettier
module.exports = {
parser: 'babel-eslint',
extends: ['plugin:prettier/recommended', 'prettier/react'],
plugins: ['prettier', 'jest'],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
ecmaFeatures: {
jsx: true,
},
@tracker1
tracker1 / npm-publish-release.yml
Last active October 15, 2020 00:36
NPM Publish Github Action
# scripts in package.json include the following...
# "prepare": "npm run build",
# "publish-major": "npm version major && git push origin master && git push --tags",
# "publish-minor": "npm version minor && git push origin master && git push --tags",
# "publish-patch": "npm version patch && git push origin master && git push --tags"
name: Publish to NPM
on:
push:
tags:
function sanitizeHtml(input) {
if (typeof input !== 'string') return input;
if (input.indexOf('<') === -1) return input;
const div = document.createElement('div');
div.innerHTML = input;
div.querySelectorAll('script').forEach((el) => el.remove());
div.querySelectorAll('style').forEach((el) => el.remove());
div.querySelectorAll('*').forEach((el) => {
const events = el.getAttributeNames().filter((a) => a.indexOf('on') === 0);
@tracker1
tracker1 / text.dat.js
Created June 15, 2020 05:21
Synchronet Default text.dat as JavaScript
// save to (exec/mods)/text.dat.js - at the top of login/login/shell files, load('text.dat.js')
bbs.replace_text(/* MsgSubj */ 1, "\1n\1h\1c\xda\xc4\xc4\xc4\xc4\xc4\xc4\1n\xc4\xc4\xc4\xc4\xc4\xc4\1h\1k\xc4\xc4\xc4\xc4\xc4\xc4\xc4\1n\1c\xc4\xc4\xc4\xc4\xc4\xfa\xfa\xfa\xfa\r\n\1h\xb3 \1bSubj\1n\1b: \1h\1c%.70s");
bbs.replace_text(/* MsgAttr */ 2, "\r\n\xb3 \1bAttr\1n\1b: \1h\1c%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s");
bbs.replace_text(/* MsgTo */ 3, "\r\n\xb3 \1bTo \1n\1b: \1h\1c%.70s");
bbs.replace_text(/* MsgToExt */ 4, " #%s");
bbs.replace_text(/* MsgToNet */ 5, " (%.40s)");
bbs.replace_text(/* MsgFrom */ 6, "\r\n\1w\xb3 \1bFrom\1n\1b: \1h\1c%.33s");
bbs.replace_text(/* MsgFromExt */ 7, " #%s");
bbs.replace_text(/* MsgFromNet */ 8, " (%.35s)");
bbs.replace_text(/* MsgDate */ 9, "\r\n\1w\xb3 \1bDate\1n\1b: \1h\1c%.24s %s (%s)\r\n\1w\xc0\xc4\xc4\xc4\xc4\xc4\xc4\1c\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\1n\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\1h\1k\xc4\xc4\xc4\xc4\xc4\xc4\xc4\xc4\1n\1c\xc4\xc4\xc4\xc4\xc4\xc4\xc4\
@tracker1
tracker1 / router-admin-scripts.sh
Created November 26, 2013 09:03
Tomato Router - Limit Guest Wifi
#Setup bridge for guest wifi (br1) with separate subnet/dhcp
# setup virtual wifi wlan0.1
#the following rules go under administration -> scripts -> firewall then reboot after saving
#NOTE: -I inserts at the beginning be default, so restrictive rules at the top, permissive at the bottom.
#default deny guest
iptables -I FORWARD -i br1 -j DROP
#Removes guest access to physical network
@tracker1
tracker1 / settings.json
Created May 6, 2020 17:17
vs code settings for synchronet /sbbs/.vscode/settings.json
{
"editor.rulers": [
76,
80
],
"editor.tabSize": 2,
"editor.renderControlCharacters": true,
"files.encoding": "cp437",
"files.associations": {
"*.ssjs": "javascript"
@tracker1
tracker1 / precheck.js
Created March 28, 2020 18:06
Modern browser SPA precheck.js
// precheck
try {
eval('(function() { async _ => _; })();');
if (typeof fetch !== 'function') throw new Error('No fetch api');
} catch (e) {
// render unsupported message in half a second - after error trap
window.setTimeout(function() {
// fallback render for development
var body = document.getElementsByTagName('body')[0];
body.className = 'message';
@tracker1
tracker1 / settings.json
Created March 21, 2020 10:01
/sbbs/.vscode/settigns.json - Synchronet config for editing with VS Code.
{
"editor.rulers": [
76,
80
],
"editor.tabSize": 2,
"editor.renderControlCharacters": true,
"files.encoding": "cp437",
"files.associations": {
"*.ssjs": "javascript"
@tracker1
tracker1 / index.js
Created December 17, 2019 18:57
Application Initialization
/*
The application uses os-service module to register itself in to an
environment based on command line parameters.
*/
const SERVICE_NAME = "my-service-name"; // TODO: changeme
// https://www.npmjs.com/package/os-service - using fork for 12.13 for now
const service = require("os-service");
const startServer = require("./feature/web-server");
@tracker1
tracker1 / ProjectName.csproj
Created December 3, 2019 15:52
DotNet Core 3, XUnit, Integrated Tests With Coverage
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<!-- Add to be able to test default assembly -->
<GenerateProgramFile>false</GenerateProgramFile>
<TargetFramework>netcoreapp3.0</TargetFramework>
<RootNamespace>ProjectName</RootNamespace>
<!-- Needed to exclude *.Test.cs from Release Build -->