Skip to content

Instantly share code, notes, and snippets.

View Komzpa's full-sized avatar

Darafei Praliaskouski Komzpa

View GitHub Profile
@Komzpa
Komzpa / configuration.yaml
Created June 30, 2024 21:37
Support for Aquara FP2 Sleep sensor using REST in Home Assistant
rest:
resource: https://rpc-ger.aqara.com/app/v1.0/lumi/res/query
method: POST
scan_interval: 3
headers:
Sys-Type: 1
Appid: FIXME
Userid: FIXME
Token: FIXME
Content-Type: application/json; charset=utf-8
create or replace procedure trim_osm_users_h3()
language plpgsql
as
$$
declare
cur_rec record;
counter integer;
total_rec integer;
last_seen timestamptz;
last_cluster timestamptz;
-----------------------------------------------------------------
pg_upgrade run on Sat Jun 22 22:08:45 2019
-----------------------------------------------------------------
command: "/usr/lib/postgresql/11/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/etc/postgresql/11/main" -o "-p 5432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/log/postgresql/pg_upgradecluster-11-12-main.LvO0'" start >> "pg_upgrade_server.log" 2>&1
waiting for server to start....2019-06-22 22:08:45.798 +03 [28771] LOG: listening on Unix socket "/var/log/postgresql/pg_upgradecluster-11-12-main.LvO0/.s.PGSQL.5432"
2019-06-22 22:08:45.952 +03 [28772] LOG: database system was shut down at 2019-06-22 22:08:44 +03
2019-06-22 22:08:45.959 +03 [28771] LOG: database system is ready to accept connections
done
server started
create or replace function is_done(g int[])
returns boolean
as
$$
select exists(
select
from (
select array [g[1], g[3], g[5], g[7], g[9]]::int[] as moves
union all
select array [g[2], g[4], g[6], g[8]]::int[] as moves
create or replace function http_get(url text)
returns text
as $$
import urllib.request
return urllib.request.urlopen(url).read().decode('utf-8')
$$
language plpython3u
parallel safe
cost 10000;
SELECT ST_Area(the_geom) As sqft, ST_Area(ST_Transform(the_geom,26986)) As sqm
FROM (SELECT
ST_GeomFromText('POLYGON((743238 2967416,743238 2967450,
743265 2967450,743265.625 2967416,743238 2967416))',2249) ) As foo(the_geom);
sqft | sqm
---------+------------------
928.625 | 86.2724304199219
19:03:21 [kom] > SELECT ST_Area(the_geom) As sqft, ST_Area(ST_Transform(the_geom,26986)) As sqm
[more] - > FROM (SELECT
kom@nucat:~/proj/postgis/regress/00-regress-install/lib$ ldd *.so
postgis-3.so:
linux-vdso.so.1 (0x00007ffc989cc000)
libgeos_c.so.1 => /usr/lib/x86_64-linux-gnu/libgeos_c.so.1 (0x00007fb47e95e000)
libproj.so.13 => /usr/lib/x86_64-linux-gnu/libproj.so.13 (0x00007fb47e8e7000)
libjson-c.so.3 => /lib/x86_64-linux-gnu/libjson-c.so.3 (0x00007fb47e6dc000)
libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007fb47e534000)
libSFCGAL.so.1 => /usr/lib/x86_64-linux-gnu/libSFCGAL.so.1 (0x00007fb47dd00000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb47db16000)
libgeos-3.7.0.so => /usr/lib/x86_64-linux-gnu/libgeos-3.7.0.so (0x00007fb47d957000)
chmod a+x ~
apt update
apt install build-essential autoconf automake libtool postgresql-server-dev-all libxml2-dev libgeos-dev libproj-dev libxml2-utils xsltproc bison postgresql-10
service postgresql start
su postgres -c 'createuser root'
su postgres -c 'psql -d postgres -c "alter user root superuser;"'
git clone git@github.com:postgis/postgis.git
cd postgis
./autogen.sh
./configure --without-raster
https://github.com/locationtech/jts/issues/298 broken delaunay triangulation:
1:
[66.103648384371410884341457858681679 68.588612471664760050771292299032211],[146.68071346210041383528732694685459 121.68071346210042804614204214885831],[128.86889656046744789819058496505022 117.26179755904141188693756703287363],[66.103648384371439306050888262689114 68.588612471664774261626007501035929],[169.55213966757199273160949815064669 146.13377653827689073295914568006992],[126.62939224605088384123519062995911 181.11140466039208263282489497214556],[74.434448280233709738240577280521393 78.630898779520691732614068314433098],[121.11140466039205421111546456813812 153.37060775394911615876480937004089],[98.888595339607888945465674623847008 186.62939224605085541952576022595167],[52.66066896814022157968793180771172 63.178539267712423566081270109862089],[85.321337936280443159375863615423441 86.357078535424832921307825017720461],[129.61570560806461571701220236718655 173.90180644032261625397950410842896],[91.52240934977427855301357340
root@debian:/home/kom/postgis# cat regress/jitbug.sql
set jit to on;
create extension postgis;
CREATE OR REPLACE FUNCTION utmzone(geometry)
RETURNS integer AS
$BODY$
DECLARE
geomgeog geometry;
zone int;