Skip to content

Instantly share code, notes, and snippets.

View njh's full-sized avatar

Nicholas Humfrey njh

View GitHub Profile
@ccaum
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;
Rule1
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
pavel-kirienko / arm-bin-to-elf.sh
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
tuxfight3r / heredoc_erb1.rb
Created July 25, 2016 14:56
ruby DATA and __END__ heredoc method
#!/usr/bin/ruby
DATA.each_line do |line|
puts line
end
__END__
Doom
Quake
Diablo
@imjacobclark
imjacobclark / README.md
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 build.sh
  • Move built kernel.img onto Raspberry Pi
  • Boot, see ACT/OK LED blinking!
@PurpleBooth
PurpleBooth / README-Template.md
Last active April 22, 2024 11:45
A template to make good README.md

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.

Prerequisites

@wholmgren
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
jpmens / mosquitto-dns-srv.diff
Created November 13, 2013 07:48
Add support for DNS SRV records to Mosquitto's mosquitto.py Code placed in the public domain, by Jan-Piet Mens, November 2013
--- mosquitto.py.orig 2013-11-12 11:41:17.000000000 +0100
+++ mosquitto.py 2013-11-13 08:44:31.000000000 +0100
@@ -45,6 +45,11 @@
import sys
import threading
import time
+HAVE_DNS = True
+try:
+ import dns.resolver
+except ImportError:
@willurd
willurd / web-servers.md
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
jpmens / builder.sh
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 https://bitbucket.org/oojah/mosquitto
$ 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 = Twilio::REST::Client.new account_sid, auth_token