Skip to content

Instantly share code, notes, and snippets.

View bassdread's full-sized avatar

bassdread

  • UK
View GitHub Profile
$ sudo -i
$ crontab -e
# add the following using your editor
* * * * * python /PATH/TO/SCRIPT/bin/read_disk_temps.py
#!/usr/bin/python
import collections
from datetime import datetime
import json
from pySMART import Device
from traceback import print_exc
try:
import redis
$ sudo smartctl --all /dev/sda -s on
smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.16.0-60-generic] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
=== START OF INFORMATION SECTION ===
Model Family: Western Digital AV SATA
Device Model: WDC WD2500AVJS-63B6A0
Serial Number: WD-WCAT10290663
LU WWN Device Id: 5 0014ee 1563ee704
Firmware Version: 01.03A01
@bassdread
bassdread / install_smartmon.txt
Created February 18, 2016 12:51
Install smartmontools on Ubuntu/Debian
sudo apt-get install smartmontools
@bassdread
bassdread / read_sensors.py
Last active February 19, 2016 07:31
Read data using pysensors and save it to a file.
#!/usr/bin/python
import collections
from datetime import datetime
import json
# https://pypi.python.org/pypi/PySensors/
# tl;dr: "sudo pip install pysensors"
import sensors
# you can install these modules with pip if needed
try:
$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sensors
>>> sensors.init()
>>> try:
... for chip in sensors.iter_detected_chips():
... print '%s at %s' % (chip, chip.adapter_name)
... for feature in chip:
@bassdread
bassdread / read_fan_speeds.py
Last active February 19, 2016 07:32
Basic Python Script to Record Fan Speeds
""" 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
// Sweep
// by BARRAGAN <http://barraganstudio.com>
// This example code is in the public domain.
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
#!/usr/bin/python
import sys
import serial
import json
def main(device, load_json=False):
device_path = "/dev/{0}".format(device)
print "Opening {}".format(device_path)
"""
Server Density Plugin
Minecraft player monitor
https://github.com/serverdensity/sd-agent-plugins/
Version: 1.0.0
"""
import json