Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Hannam chrishannam

View GitHub Profile
@chrishannam
chrishannam / readSerial.go
Created Jun 2, 2020
Read from a serial port and extract JSON.
View readSerial.go
package main
import (
"bufio"
"encoding/json"
"fmt"
"log"
"github.com/tarm/serial"
)
@chrishannam
chrishannam / readSerial.java
Created Jun 2, 2020
Read from a serial port and extract JSON.
View readSerial.java
package uk.co.chrishannam;
import com.fazecast.jSerialComm.SerialPort;
import java.io.InputStream;
public class Main {
public static void main(String[] args) {
System.out.println("Opening serial");
View .pre-commit-config.yaml
- repo: https://github.com/FalconSocial/pre-commit-python-sorter
rev: master
hooks:
- id: python-import-sorter
args: ['--silent-overwrite']
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.720
hooks:
- id: mypy
@chrishannam
chrishannam / fans.py
Created Mar 6, 2019
Read sensor data from python
View fans.py
""" Takes output from "sensors" command and writes it to
a file by default. Can also connect to Redis and Influxdb
"""
#!/usr/bin/python
import subprocess
import json
from datetime import datetime
from traceback import print_exc
View gist:a490cdd765967d7c548a858d092473c5
{% highlight ruby %}
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}
You can’t perform that action at this time.