Skip to content

Instantly share code, notes, and snippets.

import ctypes
import json
import numbers
import socket
import logging
from cassandra.telemetry.constants import PACKET_MAPPER
logging.basicConfig(
@chrishannam
chrishannam / readSerial.go
Created June 2, 2020 07:55
Read from a serial port and extract JSON.
package main
import (
"bufio"
"encoding/json"
"fmt"
"log"
"github.com/tarm/serial"
)
@chrishannam
chrishannam / readSerial.java
Created June 2, 2020 07:53
Read from a serial port and extract JSON.
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");
- 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 March 6, 2019 20:14
Read sensor data from python
""" 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
{% highlight ruby %}
def print_hi(name)
puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
{% endhighlight %}