Skip to content

Instantly share code, notes, and snippets.

Myles Eftos madpilot

Block or report user

Report or block madpilot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View WifiSwitch.ino
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
const char* ssid = "........";
const char* password = "........";
ESP8266WebServer server(80);
@madpilot
madpilot / bitbang.c
Created Jan 16, 2017
Bit-bang me some binary
View bitbang.c
/* hello-ftdi.c: flash LED connected between CTS and GND.
This example uses the libftdi API.
Minimal error checking; written for brevity, not durability. */
#include <stdio.h>
#include <ftdi.h>
#include <time.h>
#define CTS 0x08 /* CTS (brown wire on FTDI cable) */
@madpilot
madpilot / scale.rb
Created Jan 16, 2017
Scale the pulse width to 1 from 1.04
View scale.rb
#!/usr/bin/env ruby -w
require 'csv'
file = ARGV[0]
out = file.split('.').join('-normalized.')
unless file
puts "Usage: normalize [filename]"
exit(1)
end
@madpilot
madpilot / normalize.rb
Last active Jan 16, 2017
Normalize the LabNation export for my air conditioner, so each pulse is exactly 1.04
View normalize.rb
#!/usr/bin/env ruby -w
require 'csv'
file = ARGV[0]
out = file.split('.').join('-normalized.')
unless file
puts "Usage: normalize [filename]"
exit(1)
end
@madpilot
madpilot / compress.rb
Created Jan 16, 2017
Takes a LabNation export, and finds transitions. The file can be loaded in D3, for visualization
View compress.rb
#!/usr/bin/env ruby -w
require 'csv'
file = ARGV[0]
out = file.split('.').join('-compressed.')
unless file
puts "Usage: compress [filename]"
exit(-1)
end
View gulpfile.js
gulp.task('build:javascripts', function(cb) {
webpack({
entry: __dirname + '/app/frontend/javascripts/gifts.js',
output: {
path: __dirname + '/app/assets/javascripts',
filename: 'gifts.js'
},
devtool: "#source-map",
module: {
loaders: [
View xio.io
#!/bin/bash
getMyIP() {
local _ip _myip _line _nl=$'\n'
while IFS=$': \t' read -a _line ;do
[ -z "${_line%inet}" ] &&
_ip=${_line[${#_line[1]}>4?1:2]} &&
[ "${_ip#127.0.0.1}" ] && _myip=$_ip
done< <(LANG=C /sbin/ifconfig)
printf ${1+-v} $1 "%s${_nl:0:$[${#1}>0?0:1]}" $_myip
@madpilot
madpilot / icons.rake
Created Apr 17, 2015
Rake task to generate font icons from a folder full of SVGs
View icons.rake
require 'fileutils'
RANGE = (0xe000...0xf8ff);
def map_fonts(src, map_file)
map = {
'meta' => {
'author' => "Redbubble"
},
'font' => {
@madpilot
madpilot / svg-check
Created Nov 27, 2013
SVG check (Stolen from Modernizr
View svg-check
var svg = (!!document.createElementNS && !!document.createElementNS('http://www.w3.org/2000/svg', 'svg').createSVGRect);
View gist:7330189
The Problem: We have a WCF JSON API, that we need to make accessible from third-party sites (on IE7+), so JSON-P looks like a good solution.
Issue is, (what the .NET guy here has told me), each endpoint in the WCF router will need to be re-written (or added to) to handle GETs (We currently use GET, POST, and DELETE depending on the action). That sucks.
My idea: An IIS module (handler?) that intercepts JSON-P requests, and transforms the request to something the WCF router can handle, then pads the response. Basically transparent JSON-P padding around WCF.
Make sense? Does this exist already?
You can’t perform that action at this time.