Diverses

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

macOS

Auch der Mac hat seinen Bildschirm-Sperrer:

ctrl-cmd-q

oder Bildschirmschoner:

ctrl-shift-power

TimeMachine Snapshots local löschen:

[luna:~] rschumm% tmutil listlocalsnapshots /
[luna:~] rschumm% tmutil deletelocalsnapshots /

Unnötige Simulatoren löschen:

xcrun simctl delete unavailable

Extended Attributes

xattr

SQLite

sqlite3 database.sqlite
sqlite> .dump
sqlite> .tables

Brew dependencies

brew list 
brew deps --tree --installed
brew info grafana
brew uses --installed openjdk

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

openHAB

echo 'deb https://dl.bintray.com/openhab/apt-repo2 stable main' | sudo tee /etc/apt/sources.list.d/openhab.list
sudo apt list | grep openhab

systemctl status openhab2.service 
sudo systemctl start openhab
sudo openhab-cli reset-ownership

https://www.openhab.org/docs/configuration/migration/

Webserver Apache2

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

👨‍🏫 bootstrap tricks
git remote -v
git remote remove origin
git remote add origin ssh.... / https... 

git push -u ... (--set-upstream)
git push --tags ... --all 
git remote set-url origin (new url...)

if local repo already existed with some commits: 
git pull --allow-unrelated-histories origin master

👨‍🏫 update from master:  
git fetch origin
git merge origin/master

git tag -a korr -m "korrigierte Abgabe" 2405
git push —tags
git fetch --tags -f

👨‍🏫 aufräumen branches: 
git branch -a
git fetch --prune
git branch --merged
git branch --no-merged some-branch
git branch -d branchname

👨‍🏫 aufräumen files: 
git clean -i -fdx

git clean -n
git clean -fd 
git reset --hard 

git rm -r --cached ... 
find **/.project -exec git rm --cached {} \; 

git log --graph

👨‍🏫 merge aufgeben: 
git merge --abort
git reset --hard 

👨‍🏫 config:  
git config --global user.email "blabla@schumm.ch"
git config --global user.name "Rémy Schumm" 
git config --list
git config --edit
git config core.filemode false 

Review-Prozess: siehe Blog.
Trick: Comparing Stuff on GitHub

zhaw-Häck:

git log --graph --full-history --all --color --pretty=format:'%x1b[33m%h%x09%C(blue)(%ar)%C(reset)%x09%x1b[32m%d%x1b[0m%x20%s%x20%C(dim white)-%x20%an%C(reset)'
git config --global alias.graphlog "log --graph --full-history --all --color   --pretty=format:'%x1b[33m%h%x09%C(blue)(%ar)%C(reset)%x09%x1b[32m%d%x1b[0m%x20%s%x20%C(dim white)-%x20%an%C(reset)'"

git graphlog

git and ssh

if a Student has trouble with git https auth., let him/her switch to public-key-auth:

git remote -v 

generate keypair: 
ssh-keygen 

get public key: 
cd ~/.ssh
cat id_rsa.pub 

add to keychain, if you use a password: 
ssh-add ~/.ssh/id_rsa
ssh-add --apple-use-keychain ~/.ssh/id_rsa
ssh-add l


copy paste this public key to github's keys. 
copy the repo's ssh-clone-url 

switch an already checked out repo to ssh-auth: 
git remote remove origin 
git remote add origin (paste)

or if it's a new repo: 
git clone (paste)

Individueller ssh Key für git siehe Linux - SSH

S3, MinIO and Ceph

Access with Alias

https://min.io/docs/minio/linux/reference/minio-mc/mc-alias-set.html

mc alias set schuo https://objects.schumm.ch accKey secretKey
mc alias set ALIAS HOSTNAME ACCESSKEY SECRETKEY
mc alias ls   

mc du schuo/bucketName
mc stat schuo/bucketName
mc ls schuo
mc ls schuo/bucketName
etc. 

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.

MySQL / MariaDB

Connect:

mysql -u username -p -h localhost -D database

wenn nötig, kann das Passwort als Umgebungsvariable vorangestellt werden:

MYSQL_PWD=[your_password]

Overview DB size:

SELECT TABLE_SCHEMA AS `Database`,
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Data + Index Size (MB)`
FROM information_schema.TABLES ORDER BY (DATA_LENGTH + INDEX_LENGTH) DESC

Häck: Override a PHP Doctrine Migration:

INSERT INTO DoctrineMigrationVersions (version,executedAt,executionTime) VALUES ('myproject\\Migrations\\Version20240402',{ts '2024-04-15 5:06:54.0'},6001);

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