Skip to content

Instantly share code, notes, and snippets.

@jdrews
jdrews / _petfeeders.py
Last active December 19, 2023 06:08
petfeeders
import sys
import yaml
from influxdb_client import InfluxDBClient, Point
import logging
from logging.handlers import RotatingFileHandler
from datetime import datetime
# imports for surepy
import asyncio
from typing import List
@jdrews
jdrews / DrewSword.cs
Created August 12, 2023 23:39
Terraria Mod Sword
using Microsoft.Xna.Framework;
using Terraria;
using Terraria.ID;
using Terraria.ModLoader;
namespace DrewsSword.Items
{
public class DrewSword : ModItem
{
@jdrews
jdrews / VegetronixVH400.ino
Last active September 17, 2023 04:06
Collect temp, humidity and dirt moisture (wetness) from monk makes plant monitor (pmon) and a Vegetronix VH400 and ship to influxdb
// Set analogPin to the input pin
int inputAnalogPin = 0;
void setup() {
// put your setup code here, to run once:
pinMode(inputAnalogPin, INPUT);
Serial.begin(9600);
}
void loop() {
@jdrews
jdrews / ecobeeLogger.py
Created May 1, 2016 20:51
Grab temp and humidity from ecobee API and store in influxdb. Poll trigger via cron
import ecobee
from influxdb import InfluxDBClient
def logPoint(sensorName=None, sensorValue=None, sensorType=None):
return {
"measurement": sensorType,
"tags": {
"sensor": sensorName
},
"fields": {
@jdrews
jdrews / weatherLogger.py
Created May 1, 2016 20:46
Grab temp and humidity from forecast.io and store in influxdb. Poll trigger via cron
import forecastio
from influxdb import InfluxDBClient
client = InfluxDBClient(host='YOUR_IP',
port=8086,
database='YOURDB',
username='username',
password='password',
verify_ssl=False)
@jdrews
jdrews / tc-con
Last active April 21, 2016 22:04
tc-con: Manipulate Linux Kernel netem for simulation of high latency, low bandwidth, and high packet loss networks.
#!/bin/bash
#
# Script to reduce bandwidth rate and create network delay and packet loss on linux interfaces
# Can be placed on one interface (one server) or both interfaces (both servers).
#
# Simply run ./tc-con start to start it
# and ./tc-con stop to stop it.
# Run ./tc-con status to see if it's running.
#
# tc uses the following units when passed as a parameter.
@jdrews
jdrews / log-color
Last active October 24, 2015 21:23 — forked from jdanbrown/log-color
log4j logs in color!
#!/bin/bash -eu
#
# Color log4j-style logs for easier visual parsing.
#
# Usage:
# tail foo.log | log-color
# run-service | log-color
export TERM=xterm-256color