Skip to content

Instantly share code, notes, and snippets.

View thebentern's full-sized avatar

Ben Meadors thebentern

View GitHub Profile
@edgar-bonet
edgar-bonet / homodyne.ino
Created March 1, 2016 12:00
Homodyne detection of a 1 kHz signal
/*
* homodyne.ino: Homodyne detection of a 1 kHz signal.
*
* This program continuously samples analog input 0 and uses an homodyne
* detection scheme to identify a signal at 1 kHz (+/- 24 Hz @ -3dB).
*
* The analog-to-digital converter is set to "free running mode" and
* takes one sample every 104 us. The samples are multiplied by two
* generated signals at 1 kHz (the "local oscillator"), in quadrature to
* one another. The products are then low-pass filtered with a time
@tymarbut
tymarbut / README.md
Last active October 14, 2024 06:18
Baofeng (or other radio) data TX/RX for Raspberry Pi

This flow (and associated circuits/hardware) is designed to allow Node-RED to pass messages via radio waves in the same way as it passes messages via MQTT, using commonly-available, inexpensive handheld radios and the Raspberry Pi. The flow has been tested using Baofeng, Wouxun, and Quansheng handheld ham radios. In short, the goal is to allow packet-like transmissions between Node-RED systems over miles, while keeping the hardware costs down (or free for those hams who have surplus Baofengs hanging around). This could be used for a backup to MQTT when the Wifi is unreliable, or simply as a long-distance and network-agnostic message channel.

Prerequisites: Software

First, we need PulseAudio to make and receive sounds with our USB soundcard:

sudo apt-get install pulseaudio -y
@thebentern
thebentern / PostBuildNugetPack.cmd
Last active December 13, 2015 19:54
Post-build Nuget Pack and copy to local Nuget store
if $(ConfigurationName) == Release (
nuget pack "$(ProjectDir)$(ProjectName).nuspec"
xcopy "$(TargetDir)*.nupkg" "C:\LocalNuget" /y
) ELSE (
echo "Skipping nuget pack"
)
@bbx10
bbx10 / ESPWebForm.ino
Created July 21, 2015 03:31
Demonstrate using an http server and an HTML form to control an LED. The http server runs on the ESP8266.
/*
* Demonstrate using an http server and an HTML form to control an LED.
* The http server runs on the ESP8266.
*
* Connect to "http://esp8266WebForm.local" or "http://<IP address>"
* to bring up an HTML form to control the LED connected GPIO#0. This works
* for the Adafruit ESP8266 HUZZAH but the LED may be on a different pin on
* other breakout boards.
*
* Imperatives to turn the LED on/off using a non-browser http client.
@chrissimpkins
chrissimpkins / gist:5bf5686bae86b8129bee
Last active April 6, 2025 09:16
Atom Editor Cheat Sheet: macOS

Use these rapid keyboard shortcuts to control the GitHub Atom text editor on macOS.

Key to the Keys

  • ⌘ : Command key
  • ⌃ : Control key
  • ⌫ : Delete key
  • ← : Left arrow key
  • → : Right arrow key
  • ↑ : Up arrow key
@spboyer
spboyer / gulpfile.json
Created March 9, 2015 20:55
gulpfile options for generator-aspnet, as well as the Web Starter Template for ASP.NET 5 in Visual Studio
var gulp = require('gulp');
var bower = require('gulp-bower');
var del = require('del');
var project = require('./project.json');
var lib = project.webroot + '/lib';
gulp.task('default', ['bower:install'], function () {
return;
});
@ctolkien
ctolkien / gulpfile.js
Created March 4, 2015 06:16
asp.net 5 gulpfile
var gulp = require('gulp');
var bower = require('gulp-bower');
var less = require('gulp-less');
var sourcemaps = require('gulp-sourcemaps');
var aspnetk = require("gulp-aspnet-k");
var imagemin = require('gulp-imagemin');
var pngquant = require('imagemin-pngquant');
var gutil = require('gulp-util');
var plumber = require('gulp-plumber');
var colors = require('colors');
@alexbevi
alexbevi / Execute-With-Retry.ps1
Created February 6, 2015 15:28
A PowerShell cmdlet that can be used to retry a failing ScriptBlock
<#
This function can be used to pass a ScriptBlock (closure) to be executed and returned.
The operation retried a few times on failure, and if the maximum threshold is surpassed, the operation fails completely.
Params:
Command - The ScriptBlock to be executed
RetryDelay - Number (in seconds) to wait between retries
(default: 5)
MaxRetries - Number of times to retry before accepting failure
@kjlape
kjlape / POCO2Expando.cs
Created July 30, 2014 21:02
Odd little code nugget for converting POCOs to ExpandoObjects.
public static ExpandoObject ToExpando(this object obj)
{
IDictionary<string, object> expando = new ExpandoObject();
foreach (var info in obj.GetType().GetProperties())
expando.Add(new KeyValuePair<string, object>(info.Name, info.GetValue(obj)));
return (ExpandoObject)expando;
}
@jsnape
jsnape / EnumerableReader.fs
Last active November 21, 2018 14:52
F# IEnumerable<'T> -> IDataReader
open System
open System.Reflection
open System.Collections.Generic
open System.Data
open System.Linq
open System.Linq.Expressions
type private accessor<'T> = { Index: int; Name: string; Getter: 'T -> obj }
/// IEnumerable to IDataReader wrapper class