Skip to content

Instantly share code, notes, and snippets.

@bitdivision
bitdivision / gist:46a0eaeb00561c62943adeab436d5c97
Created April 23, 2019 09:37 — forked from n00neimp0rtant/gist:9515611
simple squash without rebase
## within current branch, squashes all commits that are ahead of master down into one
## useful if you merged with upstream in the middle of your commits (rebase could get very ugly if this is the case)
## commit any working changes on branch "mybranchname", then...
git checkout master
git checkout -b mybranchname_temp
git merge --squash mybranchname
git commit -am "Message describing all squashed commits"
git branch -m mybranchname mybranchname_unsquashed
git branch -m mybranchname
@bitdivision
bitdivision / fourth-wall
Last active November 19, 2018 10:44
fourthwall
[
{
"userName": "ONSdigital",
"repo": "eq-address-lookup-api"
},{
"userName": "ONSdigital",
"repo": "eq-census-schemas"
},{
"userName": "ONSdigital",
"repo": "eq-compose"
@bitdivision
bitdivision / graphs.py
Created October 2, 2018 21:18
EQ graph builder
import json
import click
from graphviz import Digraph
from collections import OrderedDict
class Graph:
def __init__(self, filename):
with open(filename, 'r') as f:
self.input = json.loads(f.read())
var fs = require("fs");
var http = require("http");
var path = require("path");
try {
var SDP = require("./sdp");
} catch (e) {
console.error("+-------------------------WARNING-------------------------+");
console.error("| sdp.js not found, will not transform signaling messages |");
console.error("+---------------------------------------------------------+");
}
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mqtt = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (process,global){
'use strict';
/**
* Module dependencies
*/
/*global setImmediate:true*/
var events = require('events'),
Store = require('./store'),
eos = require
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.mqtt = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
(function (process,global){
'use strict';
/**
* Module dependencies
*/
/*global setImmediate:true*/
var events = require('events'),
Store = require('./store'),
eos = require
wifi.setmode(wifi.STATION)
wifi.sta.config("YOUR SSID", "PASSWORD")
gpio.mode(4, gpio.OUTPUT)
tmr.alarm(0, 5000, 0, function()
m = mqtt.Client("ESP8266"..node.chipid() , 120)
m:connect("YOUR IP ADDRESS", 1883, 0, function(conn)
print("Connected to MQTT broker")
m:subscribe("esp_led", 0)
/* main.c -- MQTT client example
*
* Copyright (c) 2014-2015, Tuan PM <tuanpm at live dot com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
@bitdivision
bitdivision / longRunning.c
Created March 23, 2015 10:15
SuperSerial Long Running Example
int runSingleSlaveProcess() {
ACKResponse_t resp = {0,0,0,{0},0};
int slaveTarget = 100;
SuperSerial.pollUntilComplete(&resp, SLAVE_ID, 'A', 2, &slaveTarget);
if (resp.packetType != PACKET_NONE) {
Serial.print("Slave returned with data: ");
#include <Arduino.h>
#include <stdio.h>
#include <SuperSerial.h>
//This is around the maximum that the MAX489 chip can support
//since it has slew rate limiting
#define BAUD_RATE 100000
#define MAX489_RE 13