Diverses

Mein persönlicher Spickzettel: so Zeugs, das ich immer wieder vergesse und nicht in die anderen Spickzettel passen…

PostgreSQL

Zugriff über psql locally:

rschumm@kassandra:~$ psql --username=find --host=localhost --dbname=holz

Schnell alles neu:

sudo su - postgres
psql

create user holzdemo password 'blablabla';
create database holz with owner holzdemo; 
alter user holzdemo password 'blablabla'; 

hard stuff:

yum (etc.) install @postgresql 
sudo rm -rf /var/lib/pgsql/data
sudo postgresql-setup initdb

sudo systemctl restart postgresql

jdbc

jdbc:postgresql://localhost:5432/holz?sslmode=disable
org.postgresql.Driver

Metadaten über psql:

\c explic   connect (to DB explic)
\l          List of Databases
\dx         Display extensions
\d          Display tables etc. 
\du         Display User 

Abkürzung:

psql -d explic -c "select experiment from video";

config files:

IP listen_address Zugriff von überall * zulassen, wenn nötig:

vi /etc/postgresql/10/main/postgresql.conf  
vi /etc/postgresql/10/main/pg_hba.conf 
vi /var/lib/pgsql/data/.... 
systemctl status postgres (to find out where the files are)




host all all 0.0.0.0/0 trust

als sysdamin:

sudo systemctl restart postgresql.service

Grant-Things:

ALTER USER find SUPERUSER; 
create extension postgis; 

grant all privileges on table video to "userJaJa";

grant all privileges on sequence video_id_seq to "userJaJa";

WAL-PANIC

korruptes WAL:

2020-08-29 10:40:31.092 CEST [35132] LOG:  database system was shut down at 2020-07-02 14:10:10 CEST
2020-08-29 10:40:31.093 CEST [35132] LOG:  invalid record length at 0/B71E678: wanted 24, got 0
2020-08-29 10:40:31.093 CEST [35132] LOG:  invalid primary checkpoint record
2020-08-29 10:40:31.093 CEST [35132] PANIC:  could not locate a valid checkpoint record

gelöst durch Reset von WAL:

luna:12 postgres$ bin/pg_resetwal data/

Geo

Breite - lat - Nord-Süd (47°…)
Länge - long - West-Ost (8°…)
meistens lat/long, bei PostGIS verkehrt.

macOS

Auch der Mac hat seinen Bildschirm-Sperrer:

ctrl-cmd-q

oder Bildschirmschoner:

ctrl-shift-power

manually extract a .pgk Installer:

sometimes you have a .pkg installer, that does not much more than copy something to Applications - but wants your admin password. So, why not extract the interesting Part manually.
In this Example I extract a (simple) .pkg File, the wonderful JavaFX Scene Builder:

[luna:~/Downloads/an2] rschumm% xar -xf SceneBuilder-11.0.0.pkg 
[luna:~/Downloads/an2] rschumm% cd SceneBuilder-app.pkg/
[luna:~/Downloads/an2/SceneBuilder-app.pkg] rschumm% ls
Bom         PackageInfo Payload
[luna:~/Downloads/an2/SceneBuilder-app.pkg] rschumm% lsbom Bom 
(lists the «Bill of Materials») 
[luna:~/Downloads/an2/SceneBuilder-app.pkg] rschumm% tar xvf Payload 
(extracts the actual Payload)
[luna:~/Downloads/an2/SceneBuilder-app.pkg] rschumm% ls
Bom              PackageInfo      Payload          SceneBuilder.app
[luna:~/Downloads/an2/SceneBuilder-app.pkg] rschumm% mv  SceneBuilder.app/ ~/Desktop/
(moves the interesting Payload, here the Programm, to the Desktop or somewhere else)

This example first extracts the .pkg Archive, lists the «Bill of Materials» to see what’s planned, and then extracts the actual Payload, in this case the Application «SceneBuilder». (In this case, we can see this installer would do nothing harmfull and is by the way a very nice tool to make Java Guis…)

iOS

Beim Umstieg von iOS auf Android iMessage ausschalten. So kommen Nachrichten auch von iMessage-Users wieder an.

Design etc.

Bilder: Unsplash

Webserver

Apache Benchmarking Tool ab quick and dirty:

ab -k -c 30 -n 200 https://www.schumm.ch

Umleitungen etc:

Redirect /essen https://docs.google.com/document/d/1KpvxW5Pn5wtA_d7zTkBPHpS4r_dpPEFsTyfFCLy7o64
RedirectMatch .*/find/(.*)$ https://schufi.herokuapp.com/find/$1
RedirectMatch .*/find$ https://schufi.herokuapp.com/find
RedirectMatch .*/qr/(.*)$ https://schufi.herokuapp.com/qr/$1
#RedirectMatch 301 (.*)\.html$ http://www.domain.com$1.php
ErrorDocument 404 /error.html

Deployment auf Hostpoint

Hostpoint unterstützt Zugriff auf sftp mit ssh-Zertifikaten.

Deployment via rsync:

#(verbose, recursive, preserving dates and times, zip)
rsync -vrtz _site/* xxx@xxx.web.hostpoint.ch:~/www/public_html/schumm/

(host siehe Notizen)

git

git remote -v
git remote remove origin
git remote add origin ssh.... / https... 
git rm -r --cached ... 
git push -u ... (--set-upstream)
git push --tags ... --all 
git remote set-url origin (new url...)
git pull --allow-unrelated-histories origin master
git config core.filemode false 
git reset --hard 
git log --graph

Python

freeCAD

freeCAD runs in snap - the snap filesystem is read-only. To find out what is in the path, execute…

import sys
for p in sys.path: print(p)

…in the Python Console. To put something on the path, use the only path which is readable, hence the working directory, for example ifcopenshell. If then import ifcopenshell works, everything is fine.

DotNet

create new application:

dotnet new web 
dotnet build 
dotnet run 

Windows

after booting into a Linux, the Windows clock will be screwed up. To fix it, add following Registry:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
DWORD (32 bit)
RealTimeIsUniversal
Value: 1 

zurück zum Seitenanfang