Skip to content

Instantly share code, notes, and snippets.

View bmatusiak's full-sized avatar
☯️
Life

Bradley Matusiak bmatusiak

☯️
Life
View GitHub Profile
#ifdef USE_ECDH
#include "mbedtls/include/mbedtls/ecdh.h"
static NO_INLINE JsVar *jswrap_crypto_ecdh(JsVar *message, JsVar *key, JsVar *options, bool genSecret ) {
int ret;
JSV_GET_AS_CHAR_ARRAY(msgPtr, msgLen, message);
if (!msgPtr) return 0;
mbedtls_ecdh_context ecdh_ctx;
var net = require('net');
var fs = require('fs');
var SSH_AUTH_SOCK_PATH_PREFIX = "/tmp/ssh-agent."
var SSH_AUTH_SOCK_PATH_POSTFIX = ".sock"
function createServer(socketName, callback, onConnect) {
var SSH_AUTH_SOCK_PATH = SSH_AUTH_SOCK_PATH_PREFIX + socketName + SSH_AUTH_SOCK_PATH_POSTFIX;
uint32_t baud;
uint32_t old_baud;
void loop() {
// put your main code here, to run repeatedly:
baud = Serial.baud();
if (baud != old_baud) {
/*************************************
* Dual Channel DC Motor Driver Board*
* Code Written by Idayu - MYBOTIC *
*************************************/
int IN1 = 12;
int IN2 = 11;
int IN3 = 7;
int IN4 = 6;
@bmatusiak
bmatusiak / cs-gcode.js
Last active November 11, 2020 20:04
cgode checksum cs *:
// N0 M106*36
// N1 G28*18
// N2 M107*39
getCS("N0 M106");
getCS("N1 G28");
getCS("N2 M107");
@bmatusiak
bmatusiak / mac-terminal-bash-colors.bash_profile
Created July 22, 2020 23:41
mac bash colors bash_profile
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
#PS1="\h:\W \u\$" # Default
PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ "
var key1Name = "test13";
var key2Name = "test22";
// "hex" or "base64", default is raw(Uint8Array)
var encoding = "hex";
////-----------------------
var atob = require("atob");
var btoa = require("btoa");
#!/bin/bash
modprobe libcomposite
command="$1" # "up" or "down"
gadgetDevice="/sys/kernel/config/usb_gadget/my_gadget"
usb_up() {
// cloud9 nvm node runner
{
"script": [
"source $HOME/.nvm/nvm.sh",
"set -e",
"if ! [ \"$debug\" == true ]; then ",
" node \"$file\" $args",
"elif \"$(node -p 'parseInt(process.version.slice(1)) < 7')\" == true; then",
" FLAGS=\"--nocrankshaft --nolazy --debug-brk=$debugport\"",
" if node --nodead_code_elimination -e '' &> /dev/null; then",
@bmatusiak
bmatusiak / in-out.gun.js
Created June 1, 2020 15:39
form Dletta
/*
To have abstract application keys into a keychain, so you can keep
your keys (aka one login, but many apps) without having to constantly
shift your logins between applications or shared documents
We do this by:
- Initiate 2 instances of gun.
- The main user instance will act as you, using a key chain to keep key pairs
that apps may generate.
- All keys will be encrypted to yourself, which means only you will be able to access