Skip to content

Instantly share code, notes, and snippets.

@neutralvibes
neutralvibes / move_docker_flocation.md
Created May 25, 2022 10:53
Moving docker location

Moving docker location

Moving docker files to a different partition or physical drive can be advantageous in certain senarios.

Stop docker

sudo systemctl stop docker.service
sudo systemctl stop docker.socket
@neutralvibes
neutralvibes / parseBluetoothClass.md
Last active May 26, 2022 16:59
Parse a bluetooth class integer in javascript

Parse a bluetooth class in javascript

Translates a bluetooth class integer into its component parts

/**
 * Parses a bluetooth class integer into major class and service list
 * 
 */
function parseBlueClass (classInt) {
@neutralvibes
neutralvibes / explodingpromises.MD
Last active July 13, 2021 15:01
Externally resolving and rejecting Javascript promises

Externally resolving and rejecting Javascript promises

Recently been working with websockets and wanted a way to provide a promise based interface for calls to an api over it mirroring fetch. Inorder to do so I got the api to echo back supplied request ids with the results it handled. But what about if the connection went down? Or for some other unknown reason it was taking far too long to proccess a request? I decided to create a request queue with Promises that would explode rejecting if unresolved for a set time. These promises also need to be resolved externally from requests comming in.

The Exploding Promise

var ExplodingPromise = (timeout, timeoutWith) => {
	var result, error

Controlling cursor colors and movement in python

I recently wanted to color output in a minimal way for a commandline utility I was writing so came up with this little class.

import sys

class Cursor:
    class Color:
        BLACK="\u001b[30m"