This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # cannot use python3 because smbus not working there | |
| # Modified script from https://github.com/JasperWallace/chirp-graphite/blob/master/chirp.py | |
| # by DanielTamm | |
| import smbus, time, sys | |
| class Chirp: | |
| def __init__(self, bus=1, address=0x20): | |
| self.bus_num = bus |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from scapy.all import * | |
| import requests | |
| import time | |
| MAGIC_FORM_URL = 'http://put-your-url-here' | |
| def record_poop(): | |
| data = { | |
| "Timestamp": time.strftime("%Y-%m-%d %H:%M"), | |
| "Measurement": 'Poopy Diaper' | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Practically all this code comes from https://github.com/alangrafu/radar-chart-d3 | |
| //I only made some additions and aesthetic adjustments to make the chart look better | |
| //(of course, that is only my point of view) | |
| //Such as a better placement of the titles at each line end, | |
| //adding numbers that reflect what each circular level stands for | |
| //Not placing the last level and slight differences in color | |
| // | |
| //For a bit of extra information check the blog about it: | |
| //http://nbremer.blogspot.nl/2013/09/making-d3-radar-chart-look-bit-better.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // connect() is a function that injects Redux-related props into your component. | |
| // You can inject data and callbacks that change that data by dispatching actions. | |
| function connect(mapStateToProps, mapDispatchToProps) { | |
| // It lets us inject component as the last step so people can use it as a decorator. | |
| // Generally you don't need to worry about it. | |
| return function (WrappedComponent) { | |
| // It returns a component | |
| return class extends React.Component { | |
| render() { | |
| return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const axios = require('axios'); | |
| const http = require('http'); | |
| const https = require('https'); | |
| module.exports = axios.create({ | |
| //60 sec timeout | |
| timeout: 60000, | |
| //keepAlive pools and reuses TCP connections, so it's faster | |
| httpAgent: new http.Agent({ keepAlive: true }), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| roll_die <- function(status, strategy) { | |
| roll = sample(c(names(status), "basket"), 1) | |
| if (roll == "basket") { | |
| trees = status[names(status) != "raven" & status > 0] | |
| if (strategy == "optimal") { | |
| biggest_trees = trees[trees == max(trees)] | |
| roll = sample(names(biggest_trees), 1) | |
| } else if (strategy == "random") { | |
| roll = sample(names(trees), 1) | |
| } else if (strategy == "worst") { |
OlderNewer