Skip to content

Instantly share code, notes, and snippets.

View nklamann's full-sized avatar

Norbert Klamann nklamann

View GitHub Profile
@nklamann
nklamann / README.md
Last active November 18, 2024 09:53
Use the paperless ngx JSON-API to save data locally

This script is run at a client computer, developed under windows , but should run cross-platform. The local JSON files can be further analysed with tools like 'jq' and all kind of metainformation becomes accessible.

The script downloads data for every api endpoint.

If the variable GET_ALL_DATA in the source code is set to True, the script follows the next URL of the date recursively and collects the resutof all pages results into one result .

Speed and ressource utilization depend on a lot of foctars, subjectively I would call the thing fast.

The screen output of a test run looks like this

[
{
"_ansible_facts_gathered": true,
"ansible_all_ipv4_addresses": [
"10.20.5.204"
],
"ansible_all_ipv6_addresses": [
"2a00:6020:41e1:fea0:a00:27ff:fee0:63ba",
"2a00:6020:41e1:fe85:5:f9db:2e3f:1e85",
"2a00:6020:41e1:fe85:a00:27ff:fee0:63ba",
WITH t AS (
SELECT j
FROM read_json('https://gist.githubusercontent.com/adityawarmanfw/3107de51d1901eb3b918bcc70a5ffb31/raw/d73e365a492f6ceb50ed25816b5a90fcf57b8eb6/ansible-test.json') AS j
), get_interface_name AS (
SELECT
j->> '$.ansible_hostname' AS hostname,
concat('ansible_', unnest(j->> '$.ansible_interfaces[*]')) AS interface_name
FROM t
)
SELECT
@nklamann
nklamann / README.md
Last active November 21, 2024 12:10
OMADA openapi calls demonstration

Motivation

This is a variation of this omada example, transcribed to the new openapi. The API documentation of the softwarecontroller is in https://<omadaserver>:8043/doc.html#/home.

Scope

I wnated to test and document the uage of the new API in itself, especially the handling of the Authorization. Working with specific endpoints is ut of scope here.

Result of omada.bash

I left a lot of echo and cat statements in the code to better see what is happening. Running this on my machine i get:

@nklamann
nklamann / Result.txt
Created March 29, 2023 10:21
Trying to transfer columns from Oracle to SQLite via SQLAlchemy, related to https://github.com/sqlalchemy/sqlalchemy/discussions/9558
Traceback (most recent call last):
File "c:\projects\md2\src\testcase.py", line 28, in <module>
sqll_table.create(sqlite_engine)
File "C:\projects\md2\venv\Lib\site-packages\sqlalchemy\sql\schema.py", line 1149, in create
bind._run_ddl_visitor(ddl.SchemaGenerator, self, checkfirst=checkfirst)
File "C:\projects\md2\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 3226, in _run_ddl_visitor
conn._run_ddl_visitor(visitorcallable, element, **kwargs)
File "C:\projects\md2\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 2430, in _run_ddl_visitor
visitorcallable(self.dialect, self, **kwargs).traverse_single(element)
File "C:\projects\md2\venv\Lib\site-packages\sqlalchemy\sql\visitors.py", line 670, in traverse_single
@nklamann
nklamann / JMESPath Query
Last active February 24, 2023 12:22
Hostvars
*.{ host: inventory_hostname, data_group_handling: data_group_handling, backups_to_restic: backups_to_restic}