Skip to content

Instantly share code, notes, and snippets.

bassdread

  • UK
Block or report user

Report or block bassdread

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@bassdread
bassdread / Extract from Skynet to Plot.ly
Last active Aug 29, 2015
Extract from Skynet to Plot.ly
View 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
View gist:10301506
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()
View gist:11355648
// 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.
View gist:9b9925c1cc793dcba1d7
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()
View gist:c0ff848905db891f790e
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 / app.py
Last active Aug 29, 2015
Simple Flask App
View app.py
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__)
@bassdread
bassdread / gist:952e9df9d820c16841f3
Last active Aug 29, 2015
Analog Dial Control Code
View gist:952e9df9d820c16841f3
/*
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
View gist:e2fba4c79c09a8456928
#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);
View gist:18fa638e9a3810799772
"""
Server Density Plugin
Minecraft player monitor
https://github.com/serverdensity/sd-agent-plugins/
Version: 1.0.0
"""
import json
@bassdread
bassdread / Version Display
Created Feb 24, 2011
Display branch and version at your prompt
View Version Display
# 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\]\$ '
You can’t perform that action at this time.