Skip to content

Instantly share code, notes, and snippets.

@danclegg
danclegg / temp.py
Created November 1, 2017 19:03
A python class to present internal temperature of the Raspberry Pi
# -*- coding: utf-8 -*-
# The line above is to allow printing of the degree (°) symbol
from subprocess import call
class PanelTemperature:
degree_sign= u'\N{DEGREE SIGN}'
def __init__(self):
self.c = 0 #It is assumed C is delivered from /opt/vc/bin/vcgencmd measure_temp
self.f = 0
@danclegg
danclegg / flask_watchdog.sh
Last active October 31, 2017 18:08
Start flask app if not running
#!/usr/bin/env bash
export match=$(netstat -tlapn | grep 8011 | wc -l)
if [ $match -lt 1 ]
then
export FLASK_APP=proxy.py
cd $FLASK_APP_DIR
flask run --host=0.0.0.0 &
@danclegg
danclegg / rpi_golangInstall.sh
Last active September 26, 2017 20:52
Install golang on raspberry pi
#!/bin/bash
# derivative work
# credit: chrisvdg (https://codegists.com/snippet/shell/install-golang-armv6sh_chrisvdg_shell)
echo "Dowloading Go"
wget --no-check-certificate https://storage.googleapis.com/golang/go1.9.linux-armv6l.tar.gz
echo "extracting Go"
sudo tar -C /usr/local -xzf go1.9.linux-armv6l.tar.gz
# cleanup
@danclegg
danclegg / gist:caaccfdcf8ec63ef98faa1c49c4c6917
Last active October 12, 2016 14:26 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# One way to completely uninstall node + npm is to do the following:
# Go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*