Skip to content

Instantly share code, notes, and snippets.

View Zagrophyte's full-sized avatar

Travis Rosenbaum Zagrophyte

View GitHub Profile
@jinschoi
jinschoi / create_sub.py
Last active February 24, 2024 06:53
Python script to generate Flipper RAW .sub files from OOK bitstreams
#!/usr/bin/env python3
from typing import Iterable, Union, Any
# freq: frequency in Hz
# zerolen: length of space bit in μs
# onelen: length of mark bit in μs
# repeats: number of times to repeat sequence
# pause: time to wait in μs between sequences
# bits: string of ones and zeros to represent sequence
@mikenabhan
mikenabhan / esphome-magtag.yaml
Created September 1, 2021 02:53
This is a GIST that will help you complile MagTag firmware in ESPHome while platformIO is in a transitional state.
substitutions:
devicename: magtag
upper_devicename: Magtag
esphome:
name: magtag
platform: esp32
board: esp32dev
platformio_options:
var mqtt = require('mqtt');
var HOST = '192.168.43.10';
var client = mqtt.connect("mqtt:\/\/" + HOST, { port: 1883 });
client.on('connect', function () {
console.log("Connected to " + HOST);
client.subscribe('hermes/intent/#');
});
@jamesbulpin
jamesbulpin / hue.js
Created December 4, 2016 11:49
Service to control Philips Hue lights in response to MQTT messages
require('es6-promise').polyfill();
var hue = require("node-hue-api"),
HueApi = hue.HueApi,
lightState = hue.lightState;
var mqtt = require('mqtt');
var schedule = require('node-schedule');
// Exit once an hour to force a re-read of the Hue lights list
var j = schedule.scheduleJob(new Date((new Date()).getTime()+3600000), function() {
console.log("[" + new Date() + "] " + "Exiting after pre-set delay.");
@dazfuller
dazfuller / update-branches.ps1
Last active November 13, 2017 10:08
Update a cloned repository to track all remote branches
param (
[Parameter(Mandatory=$true, HelpMessage="Location of the Git repository to update")]
[string]$SourceLocation
)
# Test the source code location parameter
if ((Test-Path -Path $SourceLocation -PathType Container) -eq $false) {
Write-Host "The specified source code location is not valid" -ForegroundColor Red
exit 1
}
@peteroupc
peteroupc / QueryStringHelper.cs
Last active October 18, 2023 09:20
A C# utility class for parsing query strings.
// Written by Peter O.
// Any copyright to this work is released to the Public Domain.
// https://creativecommons.org/publicdomain/zero/1.0/
//
//
//
using System;
using System.Collections.Generic;
using System.Globalization;