Skip to content

Instantly share code, notes, and snippets.

View njh's full-sized avatar

Nicholas Humfrey njh

View GitHub Profile
ccaum / tasmota humidity sensor rule
Last active March 24, 2024 17:03
This Tasmota rule will automatically turn on the switch if the humidity rises more than 65% and stay on a minimum of 20 minutes.
backlog switchmode 1; poweronstate 0; TelePeriod 10;
on tele-SI7021#humidity>60 do backlog RuleTimer1 1200; power 1 endon
on power1#state do RuleTimer1 1200 endon
on Rules#Timer=1 do backlog RuleTimer1 0; power 0 endon
Rule1 1
pavel-kirienko /
Last active January 24, 2024 19:19
Converting flat binary into ARM ELF format, useful for firmware uploading via GDB
# The part .data=0x08000000 should be replaced with the correct base offset of the ROM.
# The value 0x08000000 is valid for STM32.
arm-none-eabi-objcopy -I binary -O elf32-little --change-section-address .data=0x08000000 input.bin output.elf
tuxfight3r / heredoc_erb1.rb
Created July 25, 2016 14:56
ruby DATA and __END__ heredoc method
DATA.each_line do |line|
puts line
imjacobclark /
Created December 13, 2015 17:22
Bare metal Raspberry Pi ACT blink kernel

If you care about your current kernel, move or rename it, don't delete it.

  • Remove old kernel.img from Raspberry Pi
  • Run
  • Move built kernel.img onto Raspberry Pi
  • Boot, see ACT/OK LED blinking!
PurpleBooth /
Last active April 22, 2024 11:45
A template to make good

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.


wholmgren / use-bbdiff
Last active February 26, 2024 02:02
set git difftool to bbdiff
git config --global diff.tool bbdiff
git config --global difftool.bbdiff.cmd 'bbdiff --wait --resume "$LOCAL" "$REMOTE"'
git config --global difftool.prompt false
git config --global merge.tool bbdiff
git config --global mergetool.bbdiff.cmd 'bbdiff --wait --resume "$LOCAL" "$REMOTE"'
Double check ~/.gitconfig
jpmens / mosquitto-dns-srv.diff
Created November 13, 2013 07:48
Add support for DNS SRV records to Mosquitto's Code placed in the public domain, by Jan-Piet Mens, November 2013
--- 2013-11-12 11:41:17.000000000 +0100
+++ 2013-11-13 08:44:31.000000000 +0100
@@ -45,6 +45,11 @@
import sys
import threading
import time
+HAVE_DNS = True
+ import dns.resolver
+except ImportError:
willurd /
Last active April 22, 2024 09:21
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
jpmens /
Created June 5, 2013 17:45
Build Mosquitto 1.2 on OSX Lion
# Build OpenSSL 1.0.1e (or whichever)
$ ./Configure darwin64-x86_64-cc --prefix=/usr/local/stow/openssl-1.0.1e/
$ make install
# Obtain and build Mosquitto
$ hg clone
$ hg up -r 1.2
# /usr/bin/notify-site-is-down.rb
require "rubygems"
require "twilio-ruby"
account_sid = ENV["TWILIO_ACCOUNT_SID"]
auth_token = ENV["TWILIO_AUTH_TOKEN"]
@client = account_sid, auth_token