Skip to content

Instantly share code, notes, and snippets.


Josh Levine bigjosh

View GitHub Profile
View SerialISR.ino
// put your main code here, to run repeatedly:
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
void setup() {
// put your setup code here, to run once:
bigjosh / nbits2target.js
Last active Jun 1, 2021
Convert bitcoin `nBits` field into a hex string value for `target` using only string functions
View nbits2target.js
// Returns a 64 char (256 bit) hex string of the target
// Based on
function nbits2target( nbits ) {
const significand = nbits & 0x00ffffff;
const exponent = nbits >>> (8*3);
// (all `*2` are becuase calcuations are in bytes, but in string 1 byte = 2 letter places)
const fixed6SigString = (significand.toString(16)).padStart( 3*2 , "0");
bigjosh / BlinkUntilDead.ino
Last active Jan 6, 2021
Example of how to prevent sleeping on a Move38 blink - DANGER: USE WITH CARE
View BlinkUntilDead.ino
#include "shared/blinkbios_shared_button.h"
#include "shared/blinkbios_shared_functions.h"
// Example of how to prevent a blink from going to sleep.
// This will keep blinking once per second until the battery goes dead.
// Button click will show a red flash. Note that we are making fake button presses
// to avoid warm sleep, so you can not reliabily detect an actual button press but you can
// see clicks and long presses.
bigjosh / DistributedCounterDemo.ino
Last active Dec 22, 2020
Counts the number of connected nodes in a distributed and robust way. More info at
View DistributedCounterDemo.ino
// SimpleCounter demo
// A simple distributed counter example
// On startup, blinks are dim BLUE which shows they are in IDLE mode waiting for a master
// Button press a blink to make it master of the cluster. The master will show the current count
// using the 0-342 display format decribed below under showNumber()...
// While a blink is actively part of a counting cluster, it will show dim GREEN on the face
// that points to its parent. All parent faces eventually lead back to the master.
bigjosh / showNumberDemo.ino
Last active Jun 7, 2020
Display a number 0-342 using the RGB LEDs on a blink
View showNumberDemo.ino
// Display a number 0-342 on the LEDs
// The number is shown in base 7 format with red, green,
// and blue being the 1's, 7's, and 49's places respecitively
// A 0 digit is shown as OFF. Digits 1-6 are shown as 1-6 LEDs
// lit with the place color.
// 0 = All Off
// 1 = 1 RED
// 2 = 2 RED
// ...
View BlinksValidation.ino
Blinks Dev-Kit
Validation Test for Dev Kit Blinks
4 modes for testing
1. Verify RGB on all 6 faces together
2. Verify RGB on each of the 6 faces individually
3. Verify communication w/ awake neighbors
4. Verify cold sleep (<0.2µA)
View hid_keyboard_direct.ino
This is an example for our nRF52 based Bluefruit LE modules
Pick one up today in the adafruit shop!
Adafruit invests time and resources providing this open source code,
please support Adafruit and open-source hardware by purchasing
products from Adafruit!
MIT license, check LICENSE for more information
bigjosh / Stylefile.yml
Created Jul 31, 2018
Customizations for via StyleURL.
View Stylefile.yml
version: 1.0
timestamp: '2018-07-31T17:04:46Z'
id: rSgh
shared_via: StyleURL - ( import and export CSS changes from Chrome
View scanalluntilclean.bat
REM ***This batch file will automatically run SCANPST on every PST file in the
REM ***directory specified by PST_FILE_MASK.
set SCANPST_PATH="C:\Program Files (x86)\Microsoft Office\root\Office16\SCANPST.EXE"
set PST_FILE_MASK="D:\Users\josh\Documents\My Mail\*.pst"
REM *** CD into in the directory that contains the launched batch file...
echo CDing into "%~dp0"
pushd "%~dp0"
View luckycatbrian.ino
// This Arduino sketch drives a coil to make a Lucky Cat wave
// The coil should be connected directly to pins A0 and ground
// It uses the voltage generated by the magnet passing the coil to time its pulses
// More info at...
#define LED_PIN 13 // Show a flash on this pin everytime we pulse the coil