Skip to content

Instantly share code, notes, and snippets.

@symbioquine
symbioquine / README.md
Created April 21, 2022 14:31
Running farmOS 2.x as a subpath behind a reverse proxy

Demonstrates a simple strategy to host farmOS in a subpath/subdirectory behind a reverse proxy.

Assumes that the farmos.test domain is pointing at localhost or the IP of the server where this example is being run.

The main "tricky" thing that's going on in the example is the creation of a symlink in the web root from ./farm0/ back to the web root itself. That was the simplest strategy I could find to make Drupal understand that it should serve itself from the subdirectory without more complex configuration or file moving.

@symbioquine
symbioquine / example_usage_with_pagination.js
Created March 25, 2022 03:52
Using Drupal Subrequests from Javascript
import makeDrupalSubrequest from '@/makeDrupalSubrequest';
const assetTypes = ['animal', 'land', 'plant'];
async main() {
const filterQueryString = `filter[is_location]=1`;
async function* paginateAssets() {
const requests = assetTypes.map(assetType => ({
id: assetType,
@symbioquine
symbioquine / land_kml_import.ipynb
Created February 15, 2022 16:52
farmOS + JupyterLite: Import KML
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@symbioquine
symbioquine / animal_csv_import.ipynb
Created February 12, 2022 17:50
farmOS + JupyterLite: Import a CSV of Animals
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@symbioquine
symbioquine / seeding_logs_by_weekday.ipynb
Created February 12, 2022 15:56
farmOS + JupyterLite: seeding_logs_by_weekday.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@symbioquine
symbioquine / poetry.lock
Created January 17, 2022 21:05
rewrite_fix_big_endian_geometries
[[package]]
name = "attrs"
version = "21.4.0"
description = "Classes Without Boilerplate"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
[package.extras]
dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "mypy", "pytest-mypy-plugins", "zope.interface", "furo", "sphinx", "sphinx-notfound-page", "pre-commit", "cloudpickle"]
version: '3'
services:
db:
image: postgres:12
volumes:
- './db:/var/lib/postgresql/data'
ports:
- '5432:5432'
environment:
POSTGRES_USER: farm
@symbioquine
symbioquine / LICENSE
Last active April 21, 2022 20:05
Proxying MT50 and Epever Tracer with pymodbus & epsolar_tracer
MIT License
Copyright (c) 2021 symbioquine
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@symbioquine
symbioquine / gist:ecd83655865ebe631a2ed164b665264f
Created February 14, 2021 04:02
Troubleshooting `farm_migrate_quantity` farmOS 2.x migration
# drush migrate:messages farm_migrate_quantity
[warning] array_keys() expects parameter 1 to be array, null given MigrateToolsCommands.php:626
[warning] array_map(): Expected parameter 2 to be an array, null given MigrateToolsCommands.php:626
[warning] array_combine() expects parameter 1 to be array, null given MigrateToolsCommands.php:627
[notice] No messages for this migration
# drush migrate:status farm_migrate_quantity
------------------------------------------------------- ----------------------- -------- ------- ---------- ------------- ---------------
Group Migration ID Status Total Imported Unprocessed Last Imported
------------------------------------------------------- ----------------------- -------- ------- ---------- ------------- ---------------
farmOS 1.x Quantity Migration (farm_migrate_quantity) farm_migrate_quantity Idle 559 0 559