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 };
#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 / nginx.conf
Created January 10, 2017 12:02 — forked from jrom/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@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
*
@chaeplin
chaeplin / slack_webhook_post.py
Created August 20, 2017 15:42 — forked from devStepsize/slack_webhook_post.py
POST a JSON payload to a Slack Incoming Webhook using Python requests
'''
This is an example of how to send data to Slack webhooks in Python with the
requests module.
Detailed documentation of Slack Incoming Webhooks:
https://api.slack.com/incoming-webhooks
'''
import json
import requests