Skip to content

Instantly share code, notes, and snippets.

bassdread

  • UK
View GitHub Profile
View roots_cron.txt
$ sudo -i
$ crontab -e
# add the following using your editor
* * * * * python /PATH/TO/SCRIPT/bin/read_disk_temps.py
View read_disk_temperatures.py
#!/usr/bin/python
import collections
from datetime import datetime
import json
from pySMART import Device
from traceback import print_exc
try:
import redis
View smartctl output
$ 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 Feb 18, 2016
Install smartmontools on Ubuntu/Debian
View install_smartmon.txt
sudo apt-get install smartmontools
@bassdread
bassdread / read_sensors.py
Last active Feb 19, 2016
Read data using pysensors and save it to a file.
View read_sensors.py
#!/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:
View sensors_output.txt
$ 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 Feb 19, 2016
Basic Python Script to Record Fan Speeds
View read_fan_speeds.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:a8e3cc77063e3177a337
// 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
View gist:d56af71fe6e80d3f07e1
#!/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)
View gist:18fa638e9a3810799772
"""
Server Density Plugin
Minecraft player monitor
https://github.com/serverdensity/sd-agent-plugins/
Version: 1.0.0
"""
import json
You can’t perform that action at this time.