Skip to content

Instantly share code, notes, and snippets.

View chaeplin's full-sized avatar

chaeplin chaeplin

View GitHub Profile
#!/bin/sh
## you'll have to do a couple extra steps to get this running
## there are probably other ways to handle svncanboot, but this is from the linux forum
set -e
if
touch /etc/_testr_file
then
@chaeplin
chaeplin / receiver.ino
Created December 14, 2015 03:17 — forked from rlogiacco/receiver.ino
nRF24 multiple transmitters
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
int senderId;
// Set up nRF24L01 radio on SPI bus plus pins 9 & 10
//Contacts from the radio to connect NRF24L01 pinamnam -> Arduino
@chaeplin
chaeplin / ESP8266 Code (RX node)
Created December 18, 2015 00:27 — forked from crcastle/ESP8266 Code (RX node)
Trying to use NRF24L01+ on ESP8266, using the ESP8266 as MCU (i.e. not an Arduino or ATmega328). See https://github.com/esp8266/Arduino for details on initial setup of ESP8266 as Arduino-compatible MCU. The serial output below does not show expected messages: a) the full output shows up all at once then stops dead and b) the values for _salt, vo…
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define DEVICE_ID 2
#define CHANNEL 1 //MAX 127
RF24 radio(15, 15); // Set up nRF24L01 radio on SPI bus plus pins 7 & 8
// Topology
const uint64_t pipes[2] = { 0xFFFFFFFFFFLL, 0xCCCCCCCCCCLL };
@chaeplin
chaeplin / Energy_Monitor_Real.ino
Created March 22, 2016 16:12 — forked from whatnick/Energy_Monitor_Real.ino
ESP8266 Energy Monitor Real Power
/*
* This sketch sends ads1115 current sensor data via HTTP POST request to thingspeak server.
* It needs the following libraries to work (besides the esp8266 standard libraries supplied with the IDE):
*
* - https://github.com/adafruit/Adafruit_ADS1X15
*
* designed to run directly on esp8266-01 module, to where it can be uploaded using this marvelous piece of software:
*
* https://github.com/esp8266/Arduino
*
#define TRIAC_PIN 5
#define ZERO_CROSS_PIN 4
#define DEBOUNCE_TIME 9000 //9ms - 10ms is the pulse period
static uint32_t lastPulse = 0;
static uint16_t period = 5000; //5ms - 50% for each half wave
void ICACHE_RAM_ATTR onTimerISR(){
if(GPIP(TRIAC_PIN)){//OUTPUT is HIGH
GPOC = (1 << TRIAC_PIN);//low
@chaeplin
chaeplin / SPIFFShelper.h
Created April 23, 2016 09:12 — forked from sticilface/SPIFFShelper.h
Use SPIFFS like EEPROM
struct spiffs_helper_t {
File f;
spiffs_helper_t(const char * _path ) {
f = SPIFFS.open(_path, "r+"); // try to open if there... for read and write
if (!f) {
f = SPIFFS.open(_path, "w+"); // if fail open for read/write but new
}
};
@chaeplin
chaeplin / video_upload.sh
Created April 24, 2016 06:42 — forked from brndnblck/video_upload.sh
Script for Resumable Media Uploads to Twitter
function video-upload() {
if [ $# -lt 1 ]; then
echo "[ERROR] Missing required file name."
else
FILESIZE=$(wc -c "$1" | awk '{print $1}')
printf "[START] Uploading $FILESIZE bytes.\n"
MEDIAID=$(twurl /1.1/media/upload.json -H upload.twitter.com -d "command=INIT&media_category=amplify_video&media_type=video/mp4&total_bytes=$FILESIZE" | jq .media_id_string | sed 's/\"//g')
INDEX=0
split -b 5m $1 twitter-video-
@chaeplin
chaeplin / nginx.conf
Created August 20, 2016 17:25 — forked from oroce/nginx.conf
nginx config for using grafana, elasticsearch and graphite with authentication.
user www-data;
worker_processes 1;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
sendfile on;
@chaeplin
chaeplin / Highcharts Cheat Sheet
Created November 13, 2016 04:52 — forked from mulhoon/Highcharts Cheat Sheet
Highcharts Cheat Sheet
$('#container').highcharts({
chart: {
alignTicks: true, // When using multiple axis, the ticks of two or more opposite axes will automatically be aligned by adding ticks to the axis or axes with the least ticks.
animation: true, // Set the overall animation for all chart updating. Animation can be disabled throughout the chart by setting it to false here.
backgroundColor: '#FFF', // The background color or gradient for the outer chart area.
borderColor: '#4572A7', // The color of the outer chart border.
borderRadius: 5, // The corner radius of the outer chart border. In export, the radius defaults to 0. Defaults to 5.
borderWidth: 0, // The pixel width of the outer chart border.
className: null, // A CSS class name to apply to the charts container div, allowing unique CSS styling for each chart.
defaultSeriesType: 'line', // Alias of type.
# bitcoin.py
#
# I, the copyright holder of this work, hereby release it into the public
# domain. This applies worldwide.
#
# If this is not legally possible:
# I grant any entity the right to use this work for any purpose, without any
# conditions, unless such conditions are required by law.
from tools import *