Skip to content

Instantly share code, notes, and snippets.

View kirbee's full-sized avatar

Kirbee Parsons kirbee

View GitHub Profile
@kirbee
kirbee / file-organizer-node.js
Created November 18, 2020 20:21
A quick node script I used to re-organize some documents in the way I wanted them before uploading them to Google Drive
const testFolder = './'; // to be run in the directory with all files we are looking to move
const fs = require('fs');
fs.readdirSync(testFolder).forEach((file) => {
const regex = /SL([0-9]*) Unit([0-9]*) ([0-9\.]*)/; // eg "SL001 Unit403 2005.11.30.pdf"
const test = regex.exec(file);
if (test) {
const sl = test[1]; // First matching group
const unit = test[2]; // Second matching group
const date = test[3];
@kirbee
kirbee / keyboard-move.js
Last active January 16, 2023 16:21
Small node program reading each keystroke from the command line
const readline = require('readline');
const stdin = process.stdin;
readline.emitKeypressEvents(stdin);
stdin.setRawMode(true);
class Coordinates {
constructor(x = 0, y = 0) {
this.x = x;