Skip to content

Instantly share code, notes, and snippets.

View bassdread's full-sized avatar

bassdread

  • UK
View GitHub Profile
@bassdread
bassdread / Extract from Skynet to Plot.ly
Last active August 29, 2015 13:57
Extract from Skynet to Plot.ly
from pymongo import Connection
import time
from datetime import datetime
import plotly
conn = Connection('localhost', 27017)
db = conn.skynet
collection = db.events
# 24 hour time range
import platform
import requests
class SeedBox:
def __init__(self, agentConfig, checksLogger, rawConfig):
self.agentConfig = agentConfig
self.checksLogger = checksLogger
self.rawConfig = rawConfig
self.version = platform.python_version_tuple()
// Author:Chris Hannam
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
import platform
import requests
class Weather:
def __init__(self, agentConfig, checksLogger, rawConfig):
self.agentConfig = agentConfig
self.checksLogger = checksLogger
self.rawConfig = rawConfig
self.version = platform.python_version_tuple()
import serial
import requests
from datetime import datetime, timedelta
import time
serial_port = '/dev/ttyUSB0'
ser = serial.Serial(serial_port, 9600, timeout=1)
def demo():
ser.write('0,0,135\n')
@bassdread
bassdread / gist:952e9df9d820c16841f3
Last active August 29, 2015 14:11
Analog Dial Control Code
/*
I started with the sample from this guy
Sweep
by BARRAGAN <http://barraganstudio.com>
This example code is in the public domain.
modified 8 Nov 2013
by Scott Fitzgerald
http://arduino.cc/en/Tutorial/Sweep
@bassdread
bassdread / app.py
Last active August 29, 2015 14:11
Simple Flask App
from flask import Flask
import serial
from datetime import datetime, timedelta
from time import sleep
serial_port = '/dev/tty.usbserial-A501S1GX' # most likely you will need to change this!
ser = serial.Serial(serial_port, 9600)
sleep(1.5)
app = Flask(__name__)
#include <DHT.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_TSL2561_U.h>s
#include <OneWire.h>
#include <VirtualWire.h>
#include<stdlib.h>
char *message;
Adafruit_TSL2561_Unified tsl = Adafruit_TSL2561_Unified(TSL2561_ADDR_FLOAT, 12345);
"""
Server Density Plugin
Minecraft player monitor
https://github.com/serverdensity/sd-agent-plugins/
Version: 1.0.0
"""
import json
@bassdread
bassdread / Version Display
Created February 24, 2011 09:48
Display branch and version at your prompt
# Show current git branch or SVN subfolder in prompt.
GREEN="\[\033[0;32m\]"
LIGHT_GREEN="\[\033[1;32m\]"
GRAY="\[\033[1;30m\]"
LIGHT_BLUE="\[\033[1;34m\]"
LIGHT_GRAY="\[\033[0;37m\]"
COLOR_OFF="\[\e[0m\]"
function prompt_func() {
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '