Skip to content

Instantly share code, notes, and snippets.

@andrekis
andrekis / shelly-cloud-API_CURL.sh
Created April 21, 2025 16:45 — forked from rwunsch/shelly-cloud-API_CURL.sh
Curl Shelly Cloud for values of one Shelly (here Shelly 3EM) - once per second - and add to CSV
#!/bin/bash
SHELLY_KEY=<shelly-key from https://home.shelly.cloud/index.html#/user_settings>
SHELLY_CLOUD_SERVER=<shelly-cloud-server from https://home.shelly.cloud/index.html#/user_settings eg. https://shelly-61-eu.shelly.cloud>
DEVICE_ID= <device-id from https://home.shelly.cloud>
CSV_OUTPUT_FILE=shelly_values.csv
curl -s -X POST $SHELLY_CLOUD/device/status -d "id=$DEVICE_ID&auth_key=$SHELLY_KEY" | jq -r '.data.device_status."em:0" | del(.["user_calibrated_phase"]) | [.]' | \
jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' > file.csv
@andrekis
andrekis / Alarm system.md
Created February 19, 2025 09:49 — forked from MatthewFlamm/Alarm system.md
Esp32 home alarm system with home assistant and esphome

Alarm system using esp32 with esphome and home assistant

@andrekis
andrekis / Dockerfile
Created June 7, 2023 15:55 — forked from klokan/Dockerfile
GDAL in Docker - stable GDAL with JP2KAK, MRSID and ECW: https://registry.hub.docker.com/u/klokantech/gdal/
FROM debian:7
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -qq update \
&& apt-get -qq -y --no-install-recommends install \
autoconf \
automake \
build-essential \
curl \
@andrekis
andrekis / watcher.sh
Created October 18, 2022 15:25 — forked from raelga/watcher.sh
#!/bin/bash
date
function sendMessage {
MESSAGE=$@;
if [ "${MESSAGE}" != "" ];
then
@andrekis
andrekis / libecwj2-3.3.patch
Created April 6, 2022 21:14 — forked from palmerj/libecwj2-3.3.patch
Patch to support building the libecwj2 library on MacOSX based on https://trac.osgeo.org/gdal/attachment/wiki/ECW/libecwj2-3.3.patch
diff --git a/Source/C/NCSEcw/NCSJP2/NCSJPCResolution.cpp b/Source/C/NCSEcw/NCSJP2/NCSJPCResolution.cpp
index 12a0cce..8747b24 100644
--- a/Source/C/NCSEcw/NCSJP2/NCSJPCResolution.cpp
+++ b/Source/C/NCSEcw/NCSJP2/NCSJPCResolution.cpp
@@ -1773,10 +1773,10 @@ bool CNCSJPCResolution::SD_2D_OUTPUT4(ContextID nCtx,
//Step0-1 == 2State.
//
- UINT32 n = 0;
+ INT32 n = 0;
@andrekis
andrekis / create_rgb_bigtiff_cog.sh
Created April 6, 2022 20:42 — forked from palmerj/create_rgb_bigtiff_cog.sh
Create RGBA COG with GDAL > 2.3
#!/bin/bash
set -Eeuo pipefail
BLOCKSIZE=256
OVERVIEW_BLOCKSIZE=256
MIN_OVERVIEW_SIZE=256
KEEP_TEMP=0
MOSAIC_VRT="mosaic.vrt"
MOSAIC_RGB_VRT="mosaicrgb.vrt"
@andrekis
andrekis / rgb_bigtiff_cogs_notes.md
Created January 29, 2022 21:34 — forked from palmerj/rgb_bigtiff_cogs_notes.md
Creating BigTiff COGS for raster RGB photos from a tile mosaic directory using GDAL

Creating a Cloud Optimised Geotiffs (COGs) for raster photo imagery

This process outlines the process for creating Cloud Optimised Geotiffs suitable for hosting in services such as AWS S3. COGs enables more efficient workflows use cases such as fast access from Functions as a Services (E.g AWS Lambda), or comsumption into client desktop GIS systems (e.g QGIS). For more details on COGs please see https://www.cogeo.org/in-depth.html

1. Create a mosaic

  1. Install the Proxy Server package. Just go to Package Manager in DSM and install Proxy Server.

  2. Edit squid.conf to tell it about your ad file. Ssh to the box, and edit the file /var/packages/ProxyServer/target/squid/etc/squid.conf (vi is installed by default)

You're going to add 2 lines to this file. First, under the auth_param section, you're going to add:

acl ads dstdom_regex -i "/var/packages/ProxyServer/target/squid/etc/squid.adservers"
@andrekis
andrekis / export_attribute_table_to_excel.py
Created January 5, 2022 10:11 — forked from AlexArcPy/export_attribute_table_to_excel.py
Export attribute table of a fc to an Excel workbook with xlsxwriter site-package
import xlsxwriter
import arcpy
workbook = xlsxwriter.Workbook('ResearchAreas.xlsx')
worksheet = workbook.add_worksheet()
fc = r"C:\ArcTutor\GP Service Examples\ClipAndShip\ToolData\Zion.gdb\Research_areas"
fields = [f.name for f in arcpy.ListFields(fc) if f.name.upper() not in ("OBJECTID","SHAPE")]
rows = [r for r in arcpy.da.SearchCursor(fc,fields)]
rows_structured = [list(elem) for elem in rows]
@andrekis
andrekis / arcgis_server_stress_test.py
Created January 5, 2022 10:11 — forked from AlexArcPy/arcgis_server_stress_test.py
Sample: Stress testing ArcGIS Server map service with the Python multiprocessing module and ArcREST exporting many map images in parallel
import multiprocessing
from arcrest import AGSTokenSecurityHandler
from arcrest.ags.server import Server
from arcrest.common.geometry import Envelope
ags_admin_url = r"http://localhost:6080/arcgis/admin"
ags_security_handler = AGSTokenSecurityHandler(username="username",
password="password",
org_url=ags_admin_url)