Skip to content

Instantly share code, notes, and snippets.

View glynhudson's full-sized avatar

Glyn Hudson glynhudson

View GitHub Profile
@glynhudson
glynhudson / nanode_pachube.pde
Created August 9, 2011 19:33 — forked from maniacbug/nanode_pachube.pde
Example to use EtherCard on Nanode to upload data to Pachube
// Simple demo for feeding some random data to Pachube.
// Based on pachube.pde 2011-07-08 <jcw@equi4.com> http://opensource.org/licenses/mit-license.php
// Created by <maniacbug@ymail.com>
// This has been tested with EtherCard rev 7752
// Get it from http://jeelabs.net/projects/11/wiki/EtherCard
#include <EtherCard.h>
// change these settings to match your own setup
#define FEED "33735"
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 1 column, instead of 3. in line 2.
| Id | Designator | Package | Quantity | Designation | Supplier and ref |
|----|--------------------------------------------------------|------------------------|----------|----------------|------------------|
| 1 | 1PIN,1PIN1,1PIN2 | 1pin | 3 | P | |
| 2 | C17,C18,C13,C14,C15,C16,C19,C11,C6,C7,C8,C9,C10,C12 | SM0805 | 14 | C | |
| 3 | C20 | SM0805 | 1 | 10uf | |
| 4 | U1 | ESP-12 | 1 | ESP12 | |
| 5 | P19 | SMD-MICRO-USB | 1 | USB | |
| 6 | D4 | S
@glynhudson
glynhudson / cam.sh
Last active February 12, 2017 01:09
Start Raspberry Pi h264 web cam stream
#!/bin/sh
# sudo apt-get install vlc
# sudo apt-get install gstreamer1.0
# sudo apt-get install gstreamer-tools
# https://play.google.com/store/apps/details?id=pl.effisoft.rpicamviewer2
# Launch Stream
echo "Starting Stream"
echo $(date)
@glynhudson
glynhudson / remove_bottom_lines.sh
Last active March 2, 2017 11:53
Remove x number of lines from the bottom of all html files in a directory (default 1 line removed)
for file in ./*.html; do
[ -f "$file" ] &&
length=$(tail -n 1 "$file" | wc -c) &&
[ "$length" -gt 0 ] &&
truncate -s "-$length" "$file"
done
@glynhudson
glynhudson / gopro.sh
Created February 28, 2018 00:54
GoPro Timelapse
# https://gist.github.com/KonradIT/ee685aee15ba1c3c44b4
$ ls > gopro.txt
$ mencoder -nosound -ovc lavc -lavcopts \
vcodec=mpeg4:mbd=2:trell:autoaspect:vqscale=3 \
-vf scale=1920:1080 -mf type=jpeg:fps=20 \
mf://@gopro.txt -o gopro.mp4
@glynhudson
glynhudson / gist:767c7c3d0cad92686d0c3a42834bc154
Last active March 2, 2018 00:24
Handbrake Batch Convert - Convert all DHI phantom 4 MP4 to am MP4 that will play on android devices
#!/bin/bash
# Convert DHI phantom 4 / Mavi MP4/MPV to an MP4 that will play on android devices
# Adjust extension and handbreak preset as required
# To install Handbrake
# sudo add-apt-repository ppa:stebbins/handbrake-releases
# sudo apt-get update
# sudo apt-get install handbrake-gtk
# sudo apt-get install handbrake-cli
@glynhudson
glynhudson / rename-m4v.sh
Created July 25, 2018 15:48
Rename extension of all files in a folder
# rename all files with extension passed as argument 1 to m4v
# e.g to rename MOV extension to m4v ./rename-m4v.sh MOV
for file in *.$1
do
mv "$file" "${file%.$1}.m4v"
done
@glynhudson
glynhudson / Arduino Serial CSV decoder
Created August 10, 2011 22:30
Arduino Serial CSV decoder - sketch to convert serial data received in CSV format into variables
/****************************** Functions **************************************/
/*************************************************************************************************/
// Gets the serial command from the serial port, decodes it and performs action
/*********************************************************************************************/
// Decodes a serial input string in the form a255,65535,65535,65535,65535 CR
// So an alpha command a (arg0), followed by up to 5 numerical arguments (arg1 to arg5)
// If any of the arguments are missing they will default to zero
// so b1 = b,1,0,0,0,0 and b,1 = b,1,0,0,0,0
// Always produces 6 comma separated terms, of which the first is alpha
@glynhudson
glynhudson / renamespace.sh
Created January 31, 2017 20:23
Bash script to rename file names in a folder to remove spaces and special characters, used when importing photos into Piwigo
#!/bin/bash
# Convert filenames to lowercase
# and replace characters recursively
#####################################
if [ -z $1 ];then echo Give target directory; exit 0;fi
find "$1" -depth -name '*' | while read file ; do
directory=$(dirname "$file")
oldfilename=$(basename "$file")
@glynhudson
glynhudson / gist:6f7ebc8be0ca594e02a37bf950ff5b75
Created August 18, 2022 00:51
Samsung ASHP modbus MIM-B19N
import minimalmodbus
import serial
import struct
import time
def millis():
return int(round(time.time() * 1000))
def C(val):
return struct.pack('!H', val)