Skip to content

Instantly share code, notes, and snippets.

Avatar
🔬
Experimenting

John Beech johnbeech

🔬
Experimenting
View GitHub Profile
View StringReplace.py
class StringReplace:
"""
String replace node
"""
def __init__(self):
pass
@classmethod
def INPUT_TYPES(s):
"""
@johnbeech
johnbeech / README.md
Last active March 12, 2023 20:03
Creating a GoNorth REST Client in NodeJS (See: https://github.com/steffendx/GoNorth/issues/116)
View README.md

GoNorth JS API Client

  • Requires Node LTS (e.g. Node 18)
  • Install deps: npm install
  • Run node client.js
Hosting swagger file on http://localhost:7200/gonorth_swagger.json
Hosting swagger ui on http://localhost:7200/ui/
Proxying requests on http://localhost:7200/api/ to http://localhost:5000/api/
@johnbeech
johnbeech / endpoints-openapi.ts
Created March 8, 2023 10:47
Generate Open API spec from AWS API Gateway
View endpoints-openapi.ts
import path from 'node:path'
import { Duration } from 'aws-cdk-lib'
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs'
import { Runtime } from 'aws-cdk-lib/aws-lambda'
import { Construct } from 'constructs'
import { PolicyStatement } from 'aws-cdk-lib/aws-iam'
export const createOpenAPILambda = (scope: Construct): NodejsFunction => {
const apiInformationPolicy = new PolicyStatement({
actions: ['apigateway:GET'],
View filterEmptyArrays.js
console.time('file')
console.log('Do the things')
const listToFilter = [3, 5, '', null, 'yes', 'keep']
const limit = 10000000
let filteredList
console.log('Array size:', listToFilter.length, listToFilter)
console.log('Iterations:', limit)
View MERMAID-COLOURS-DEMO.md
graph LR
  subgraph colours["Default Colours"]
    box["Source"]
    box --> thing["Target"]
  end
@johnbeech
johnbeech / matrix.js
Last active August 20, 2020 14:04
Turn a page into matrix scrolling code.
View matrix.js
var canvas = document.createElement('canvas')
document.body.appendChild(canvas)
canvas.style.position = 'absolute';
canvas.style.width = '100vw';
canvas.style.height = '100vh';
canvas.style.top = 0;
canvas.style.left = 0;
canvas.style.zindex = 100;
var ctx = canvas.getContext('2d');
var columns = [];
@johnbeech
johnbeech / run.js
Last active April 7, 2020 11:19
Multi-repo software dependency updater - for projects using node, npm, and github
View run.js
/*
## Software Dependency Updater
A self contained multi-repo software dependency updater script - for projects using node, npm, and github.
## Prerequisites
- node > 10
- npm > 6
@johnbeech
johnbeech / Factorio Map Exchange String
Created December 22, 2019 21:47
Water lands, no biters.
View Factorio Map Exchange String
>>>eNpjYBBk8GcAgwYHILbnYEnOT8xhYHCwZ2A44ADCXMn5BQWpR
br5RanIwpzJRaUpqbr5mUDFDAjFqXmpuZW6SYnFqSDToCbbc2QW5
eehm8BaXJKfhypSUpSaWgzSsHqVlh2I5i4tSszLLM2F6EXYw8DoG
HZtS0OLHAMI/69nUPj/H4SBrAdAdQ8YGGBWMzACxaCAUTY5P6+kK
D9Htzi1pCQzL90qNz+zuKS0KNUqKTOxmMNAz9QABFiTczLT0hgYF
ByB2AlkCiMjY7XIOveHVVPsGSFm6TlAGR+gIgeSYCKeMIafA04pF
RjDBMkcYzD4jMSAWFoCtAKqisMBwYBItoAkGRl7325d8P3YBTvGP
ys/XvJNSrBnNHQVeffBaJ0dUJId5HkmODFrJgjshHmFAWbmA3uo1
E17xrNnQOCNPSMrSIcIiHCwABIHvJkZGAX4gKwFPUBCQYYB5jQ7m
DEiDoxpYPAN5pPHMMZle3R/AAPCBmS4HIg4ASLAFsJdxghhOvQ7M
View Factorio Releases
0.17.23|Fri Mar 29, 2019 4:57 pm
0.17.22|Fri Mar 29, 2019 12:44 pm
0.17.21|Tue Mar 26, 2019 8:46 pm
0.17.20|Tue Mar 26, 2019 4:49 pm
0.17.19|Tue Mar 26, 2019 2:55 pm
0.17.18|Mon Mar 25, 2019 6:24 pm
0.17.17|Thu Mar 21, 2019 7:49 pm
0.17.16|Tue Mar 19, 2019 9:50 pm
0.17.15|Mon Mar 18, 2019 8:33 pm
0.17.14|Fri Mar 15, 2019 8:20 pm
@johnbeech
johnbeech / Console Output
Created January 14, 2019 22:00
ftp-deploy 501 Error: Invalid number of arguments - remoteRoot: '/' not working (works ok if I changed roots to /site
View Console Output
>node deploy stage-all
[Deploy] stage-all : { include: [ 'site/**/*' ] }
[Deploy] Connected to: ftp.mkv25.net
[Deploy] Connected: Server message: 192.252.146.30 FTP server ready
[Deploy] Error: { Error: Invalid number of arguments
at makeError (C:\Users\User\Work\Local\mkv25-responsive-website\deploy\node_modules\@icetee\ftp\lib\connection.js:1128:13)
at Parser.<anonymous> (C:\Users\User\Work\Local\mkv25-responsive-website\deploy\node_modules\@icetee\ftp\lib\connection.js:122:25)
at Parser.emit (events.js:182:13)
at Parser._write (C:\Users\User\Work\Local\mkv25-responsive-website\deploy\node_modules\@icetee\ftp\lib\parser.js:61:10)
at doWrite (_stream_writable.js:410:12)