Skip to content

Instantly share code, notes, and snippets.

Avatar

Nathan Kellenicki nathankellenicki

View GitHub Profile
View node-poweredup Technic Color Sensor LED Example.js
const PoweredUP = require("node-poweredup");
const poweredUP = new PoweredUP.PoweredUP();
poweredUP.scan();
console.log("Looking for Hubs...");
poweredUP.on("discover", async (hub) => {
await hub.connect();
View simplemetrics.js
// Simple metrics gathering
export default class SimpleMetrics {
constructor () {
this.mainStartTime = +(new Date());
this.startTimings = {};
this.reportedTimings = [];
}
startTiming () {
View colordistancesensor.log
lpf2hubmodeinfo Port 00, type 0025 (COLOR_DISTANCE_SENSOR) +8s
lpf2hubmodeinfo Port 00, hardware version 1.0.00.0000, software version 1.0.00.0000 +0ms
lpf2hubmodeinfo Port 00, total modes 11, input modes 11001011111, output modes 00010100000 +30ms
lpf2hubmodeinfo Port 00, mode combinations [1001111] +45ms
lpf2hubmodeinfo Port 00, mode 0, name COLOR +15ms
lpf2hubmodeinfo Port 00, mode 0, RAW min 0, max 10 +30ms
lpf2hubmodeinfo Port 00, mode 0, PCT min 0, max 100 +30ms
lpf2hubmodeinfo Port 00, mode 0, SI min 0, max 10 +30ms
lpf2hubmodeinfo Port 00, mode 0, SI symbol IDX +30ms
lpf2hubmodeinfo Port 00, mode 0, Value 1 x 8bit, Decimal format 3.0 +44ms
@nathankellenicki
nathankellenicki / hwid.js
Created Mar 18, 2020
HWid Decryption Functions
View hwid.js
private _parseHandshake (handshake: Buffer) {
const publicKey = handshake.slice(25, 58);
const salt = handshake.slice(132, 136);
this._theirPublicKey = publicKey;
this._theirSalt = salt;
}
private _sendHandshake () {
const ecdh = crypto.createECDH("prime256v1");
@nathankellenicki
nathankellenicki / index.html
Last active Jun 30, 2020
Bank of the Core GCC-1000 Currency Converter
View index.html
<!DOCTYPE html>
<html>
<head>
<title>Bank of the Core GCC-1000 Currency Converter</title>
<script>
// Made by Nathan Kellenicki (@nkellenicki/@nathankellenicki), because why not.
// This allows conversion between various fictional Star Wars currencies.
const base = 'USD';
View duplotrainbase.log
Looking for Hubs...
Connected to NK_DuploCargo!
lpf2hubmodeinfo Port 00, type 0029 (DUPLO_TRAIN_BASE_MOTOR) +0ms
lpf2hubmodeinfo Port 00, hardware version 0.0.00.0001, software version 0.0.00.0001 +1ms
Attached device 41 to undefined
lpf2hubmodeinfo Port 01, type 002a (DUPLO_TRAIN_BASE_SPEAKER) +1ms
lpf2hubmodeinfo Port 01, hardware version 0.0.00.0001, software version 0.0.00.0001 +0ms
Attached device 42 to undefined
lpf2hubmodeinfo Port 11, type 0017 (HUB_LED) +0ms
lpf2hubmodeinfo Port 11, hardware version 0.0.00.0001, software version 0.0.00.0001 +1ms
@nathankellenicki
nathankellenicki / ubuntu-kernel-4.14.11.sh
Last active Jan 4, 2018
Upgrading Ubuntu 16.04 to Kernel 4.14.11 for Meltdown/Spectre
View ubuntu-kernel-4.14.11.sh
#!/bin/bash
mkdir kernel
cd kernel
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14.11/linux-headers-4.14.11-041411-generic_4.14.11-041411.201801022143_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14.11/linux-image-4.14.11-041411-generic_4.14.11-041411.201801022143_amd64.deb
wget http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14.11/linux-headers-4.14.11-041411_4.14.11-041411.201801022143_all.deb
sudo dpkg -i *.deb
cd ..
rm -rf kernel
sudo reboot now
@nathankellenicki
nathankellenicki / Dockerfile.template
Created Nov 16, 2016
Cassandra 3.9 with Stratio Lucene secondary indices Dockerfile
View Dockerfile.template
FROM cassandra:3.9
RUN apt-get update && \
apt-get install -y wget git-core maven ca-certificates && \
/var/lib/dpkg/info/ca-certificates-java.postinst configure
RUN wget --header "Cookie: oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u71-b15/jdk-8u71-linux-x64.tar.gz && \
mkdir /opt/jdk && \
tar -zxf jdk-8u71-linux-x64.tar.gz -C /opt/jdk/ && \
rm jdk-8u71-linux-x64.tar.gz && \
@nathankellenicki
nathankellenicki / keybase.io
Created Feb 26, 2015
Keybase.io Verification
View keybase.io
### Keybase proof
I hereby claim:
* I am nathankunicki on github.
* I am nathankunicki (https://keybase.io/nathankunicki) on keybase.
* I have a public key whose fingerprint is 8A9B ABD6 C7D3 D390 C57C 7608 9083 521A CC71 CB15
To claim this, I am signing this object:
@nathankellenicki
nathankellenicki / jump.sh
Created Aug 19, 2013
A very small utility to mark and jump between local directories. Copypasta into your .bash_profile (I can't take credit for this, though I also can't find where I originally found it. I've made a few modifications.)
View jump.sh
export MARKPATH=$HOME/.marks
function jump {
cd -P $MARKPATH/$1 2>/dev/null || echo "No such mark: $1"
}
function mark {
mkdir -p $MARKPATH; ln -s "$(pwd)" $MARKPATH/$1
}
function unmark {
rm -i $MARKPATH/$1
}