Skip to content

Instantly share code, notes, and snippets.

View sbrl's full-sized avatar

Starbeamrainbowlabs sbrl

View GitHub Profile
@sbrl
sbrl / rmhash.sh
Last active January 30, 2018 23:04
[rmhash] Bash script to delete files if they have a hash equal to that of another file. #cli #tool
#!/usr/bin/env bash
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ] ; then
echo Invalid number of parameters. This script takes 2 or 3 parameters.
echo
echo This script files files that have a hash equal to that of a specified
echo file and deletes them.
echo
echo =-=-=-=-=-
echo =- Help -=
@sbrl
sbrl / spellings.txt
Last active January 30, 2018 23:04
A find / replace list of common spelling errors for @TheTypoMaster. Taken from Wikipedia. #wordlist #dataset
abandoned - abandonned
aberration - aberation
abilities - abilties
ability - abilty
abandon - abondon
about - abbout
about - abotu
about a - abouta
about it - aboutit
about the - aboutthe
@sbrl
sbrl / spelling-list-parser.cs
Created September 9, 2015 06:37
Code to parse wikipedia's list of spelling correction into a format that @TheTypoMaster's code can understand. The headers / footers must be removed manually.
using System;
using System.IO;
public class Program
{
public static void Main()
{
StreamReader source = new StreamReader("wikipedia-spelling-corrections.txt");
StreamWriter dest = new StreamWriter("wikipedia-spelling-corrections-new.txt");
while(!source.EndOfStream)
@sbrl
sbrl / node-update
Created October 6, 2015 14:04
A simple bash script to update Node.js to the latest version.
#!/bin/bash
echo "> Getting latest version number"
VERSION=v${1:-$(curl https://nodejs.org/dist/index.json | sed -e 's/^.*"version":"\([^"]*\)".*$/\1/' | head -n 2 | tail -n -1 | cut -c 2-)}
NODEJS=node-${VERSION}-linux-x64
echo "> Downloading $VERSION of node.js"
curl -s https://nodejs.org/dist/${VERSION}/${NODEJS}.tar.xz | tar xvfJ -
echo "> Setting ownership of /usr/local to $USER"
@sbrl
sbrl / Vector.mjs
Last active August 30, 2019 03:50
[Vector.mjs] A simple ES6 Vector class. #microlibrary
"use strict";
/******************************************************
************** Simple ES6 Vector2 Class **************
******************************************************
* Author: Starbeamrainbowlabs
* Twitter: @SBRLabs
* Email: feedback at starbeamrainbowlabs dot com
*
* From https://gist.github.com/sbrl/69a8fa588865cacef9c0
@sbrl
sbrl / init.js
Last active August 29, 2022 12:32
Atom Settings Backup by https://atom.io/packages/sync-settings
/*
* Your init script
*
* Atom will evaluate this file each time a new window is opened. It is run
* after packages are loaded/activated and after the previous editor state
* has been restored.
*
* An example hack to log to the console when each text editor is saved.
*
* atom.workspace.observeTextEditors (editor) ->
@sbrl
sbrl / Bezier.js
Last active March 7, 2021 18:49
[Bezier.js] A bezier curve class that takes an arbitrary number of control points. Originally written for my university coursework. #es6 #module #microlibrary
"use strict";
/******************************************************************************
*************************** ES6 Bezier Curve Class ***************************
******************************************************************************
* v0.4
******************************************************************************
* A bezier curve class that supports an arbitrary number of control points.
* Originally written for my 2D Graphics coursework at University.
*
* Bug reports can be made as a comment on this gist, or
@sbrl
sbrl / keybase.md
Created December 14, 2015 13:19
Keybase GitHub verification

Keybase proof

I hereby claim:

  • I am sbrl on github.
  • I am sbrl (https://keybase.io/sbrl) on keybase.
  • I have a public key whose fingerprint is C2F7 843F 9ADF 9FEE 264A CB9C C1C6 C0BB 001E 1725

To claim this, I am signing this object:

@sbrl
sbrl / drawShape.js
Last active December 19, 2015 16:18
Draws a n sided shape of radius r to the given context.
function drawShape(context, pos, sides, radius, rotation)
{
if(typeof radius !== "number")
rotation = 0;
console.log(`Drawing shape at ${pos.toString()}. Sides: ${sides}, Radius: ${radius}`);
context.save();
context.translate(pos.x, pos.y);
@sbrl
sbrl / 0_reuse_code.js
Created December 20, 2015 19:48
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console