Skip to content

Instantly share code, notes, and snippets.

View paul121's full-sized avatar

Paul Weidner paul121

View GitHub Profile
@paul121
paul121 / 1.txt
Last active August 4, 2016 18:15
Paul Atom Settings
asdfasfd
@paul121
paul121 / docker-compose.yml
Last active September 8, 2019 19:31
docker-compose.yml for bare D7 install
version: '3.1'
services:
drupal:
image: drupal:7.67-apache
ports:
- 80:80
- 443:443
volumes:
@paul121
paul121 / log_gen.py
Created November 5, 2019 19:23
Generate random egg harvest values for a date range
from datetime import date, timedelta
import random
import logging
from farmOS import farmOS
f = farmOS('tilth2019.farmos.net', 'paul', 'password')
log_name = 'Egg Collection'
log_type = 'farm_harvest'
@paul121
paul121 / weight_gen.py
Last active May 22, 2020 20:34
Generate semi accurate cow weights
from datetime import date, timedelta
import os
import random
import math
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'
from farmOS import farmOS
farm = farmOS(hostname='http://localhost', username='user', password='pass', client_id='farm', scope='user_access')
@paul121
paul121 / log_loop.py
Created November 13, 2019 02:19
Looping through log results
farm = farmOS(hostname=hostname, username=username, password=password)
test_log_done = {'name':'This is log is done', 'type':'farm_observation','done': 1}
test_log_not_done = {'name':'This is log is NOT done', 'type':'farm_observation', 'done': 0}
farm.log.send(test_log_done)
farm.log.send(test_log_not_done)
all_logs = farm.log.get()
for log in all_logs['list']:
@paul121
paul121 / server-info-flow.json
Created November 27, 2019 09:19
node-red test flow
[
{
"id": "58ff452f.d398fc",
"type": "tab",
"label": "Test farmOS Flow",
"disabled": false,
"info": ""
},
{
"id": "4e4527de.360678",
@paul121
paul121 / farmos-auth-flow.json
Created November 27, 2019 21:43
famrOS node-red auth flow
[
{
"id": "58ff452f.d398fc",
"type": "tab",
"label": "Test farmOS Flow",
"disabled": false,
"info": ""
},
{
"id": "9793e818.72b8b8",
@paul121
paul121 / aggregator_tracker.py
Last active January 2, 2020 08:00
Aggregator Tracker Brainstorm
from farmosaggregator import Tracker
# Define a tracker that inherits from the Aggregator Tracker base class
class SpinachStudy(Tracker):
def __init__(self):
self.name = "Spinach Study Tracker"
self.description = "Aggregate spinach plantings and field data for analysis."
def get_farm_data(self, farmos_client):
# this list represents one farm's data for the study
@paul121
paul121 / restws_oauth2_server.module
Created January 14, 2020 18:28
OAuth Path Scope Check
/**
* Implements hook_init().
*
* Performs a user login from the User ID of the Authentication Token.
*/
function restws_oauth2_server_init() {
// Load the OAuth2 Server and Scope that are to be authenticated against.
$server_name = variable_get('restws_oauth2_server_name', FALSE);
$scope_name = variable_get('restws_oauth2_server_scope', FALSE);
@paul121
paul121 / module.js
Last active February 4, 2020 22:43
Field Module template files (DRAFT)
// This file should be in a ~/dist directory (can't show directories in gists)
// Field Module Code here