Skip to content

Instantly share code, notes, and snippets.

View monkbroc's full-sized avatar

Julien Vanier monkbroc

View GitHub Profile
@monkbroc
monkbroc / reader.py
Created November 16, 2024 02:40 — forked from rbrott/reader.py
import enum
import struct
import typing as T
from dataclasses import dataclass, field
from collections import defaultdict
import csv
import sys
import argparse
import os
@monkbroc
monkbroc / usb_to_uart.ino
Last active September 21, 2018 17:32
Particle Photon USB to UART passthrough
/* Pass through all data from USB serial to UART serial (TX/RX pins)
*/
SYSTEM_THREAD(ENABLED);
SYSTEM_MODE(MANUAL);
void setup() {
Serial1.begin(9600);
Serial.begin();
}
@monkbroc
monkbroc / application.cpp
Created September 16, 2018 23:17
Hardware accelerated Neopixel for nRF52840
#include "application.h"
#include "nrfx_pwm.h"
#include "nrf_gpio.h"
#include "pinmap_impl.h"
SYSTEM_MODE(MANUAL);
#define PIXEL_COUNT 44
#define BITS_PER_PIXEL 24
@monkbroc
monkbroc / blink.ino
Created August 1, 2018 02:00
Pass make options to Particle cloud compile
@monkbroc
monkbroc / server.js
Last active October 30, 2017 21:23
Webhook server
/* Simple webserver that logs all requests to /hook to a file
* Usage:
* npm install express
* node server.js
*/
var express = require('express');
var fs = require('fs');
var app = express();
@monkbroc
monkbroc / git-amend
Created July 29, 2017 03:48
Useful git commands
#!/bin/bash
# Save as ~/bin/git-amend then chmod +x ~/bin/git-amend
# Usage: `git amend` to silently amend a previous commit
git commit --amend --no-edit $*
@monkbroc
monkbroc / index.js
Last active July 10, 2017 22:19
Extract the Slack message history per channel for a time period
// Extract the Slack message history per channel for a time period
// Gives an idea which Slack channels are most used
// Usage:
// Save SLACK_TOKEN in .env file
// npm install
// npm start | tee slack_channels.csv
const WebClient = require('@slack/client').WebClient;
const Promise = require('bluebird');
const moment = require('moment');
@monkbroc
monkbroc / internet-button-electron.ino
Created February 26, 2017 21:37
Internet Button Electron
#include "InternetButton.h"
#include "math.h"
/* Let me show you how easy it is to put the Button on the Internet.
Useful info, like how to access the data from your browser, can be
found here: http://docs.particle.io/photon/firmware/#particle-function
The code to control the number of illuminated LEDs is here:
https://github.com/spark/InternetButton/blob/master/controlKnob.html
Try naming one of your devices "InternetButton" and running controlKnob in your browser or on your phone!
@monkbroc
monkbroc / pi_build
Created November 30, 2016 14:49
Particle on Raspberry Pi local build script
#!/bin/bash
FIRMWARE=~/Programming/firmware
docker run --rm -it -v $FIRMWARE:/firmware -v $PWD:/input -v $PWD:/output particle/buildpack-raspberrypi $*
@monkbroc
monkbroc / pixel-wave.ino
Created November 23, 2016 21:30 — forked from anonymous/pixel-wave.ino
Pixel Wave
/* Pixel wave
* Copyright 2016 Julien Vanier, MIT license
*
* Connect 3 photoresistors to analog inputs and drive a Dotstar/Neopixel strip from the 3 analog signals!
*/
#include "application.h"
#include "dotstar/dotstar.h"
SYSTEM_THREAD(ENABLED);