Skip to content

Instantly share code, notes, and snippets.

View alexbartsch's full-sized avatar

Alexander Bartsch alexbartsch

View GitHub Profile

Übung: Einführung in Node.js Express und REST-Schnittstelle

Schritte

Projektinitialisierung

  • Erstelle ein neues Verzeichnis für dein Projekt.
  • Navigiere in das Projektverzeichnis.
  • Führe den Befehl npm init aus, um ein neues package.json-Datei zu erstellen.

Express-Installation und Body-Parser

@alexbartsch
alexbartsch / extract-pdf-pages.md
Created November 27, 2023 21:20
Aufgabe: PDF-Seiten extrahieren und als separate PDF-Dateien speichern mit Node.js

Aufgabe: PDF-Seiten extrahieren und als separate PDF-Dateien speichern mit Node.js

Deine Aufgabe ist es, eine PDF-Datei zu öffnen, ihre Seiten zu extrahieren und jede Seite als separate PDF-Datei zu speichern. Verwende dazu Node.js. Du kannst eine externe Bibliothek wie pdf-lib nutzen, um die Verarbeitung von PDF-Dateien zu erleichtern.

Los geht's:

Projektinitialisierung:

Leg ein neues Node.js-Projekt an. Benutze die Kommandozeile, um ein Verzeichnis für dein Projekt zu erstellen und führe npm init -y aus, um ein package.json-Datei zu erstellen.

PDF-Verarbeitungsbibliothek installieren:

helo client.mydomain.com
mail from:<client@mydomain.com>
rcpt to:<receipient@yourdomain.com>
data
From: client@mydomain.com
Subject: test mail from command line
this is test number 1
sent from linux box
.
@alexbartsch
alexbartsch / delete-old-branches.sh
Last active September 6, 2018 08:45
Delete old local branches
git branch -vv | grep 'origin/.*: gone]' | awk '{print $1}' | xargs git branch -d
# for german cli use
git branch -vv | grep 'origin/.*: entfernt]' | awk '{print $1}' | xargs git branch -d
@alexbartsch
alexbartsch / copy-to-remote.sh
Created April 5, 2017 19:26
Copy local files and directories to remote
# Copy local files and directories to remote
rsync -av /local/dir/ server:/remote/dir/
@alexbartsch
alexbartsch / docker-remove-all.sh
Last active April 26, 2017 11:12
Remove all docker images and containers
# Remove all docker images and containers
docker stop $(docker ps -a -q) && docker rm $(docker ps -a -q) && docker rmi $(docker images -q)
docker build -t friendlyname . # Create image using this directory's Dockerfile
docker run -p 4000:80 friendlyname # Run "friendlyname" mapping port 4000 to 80
docker run -d -p 4000:80 friendlyname # Same thing, but in detached mode
docker ps # See a list of all running containers
docker stop <hash> # Gracefully stop the specified container
docker ps -a # See a list of all containers, even the ones not running
docker kill <hash> # Force shutdown of the specified container
@alexbartsch
alexbartsch / scp-download-dir.sh
Created April 3, 2017 12:43
Download directory via scp
# Download directory via scp
scp -r <user>@<host>:/path/to/dir /path/to/target/destination
@alexbartsch
alexbartsch / docker-rmi-untagged.sh
Created April 3, 2017 12:40
Remove all untagged docker images
# Remove all untagged docker images
docker rmi $(docker images -q -f "dangling=true")
ssh <ssh-user>@<ssh-host> -L <local-port>:<remote-host>:<remote-port> -N
@alexbartsch
alexbartsch / update-branch-list.sh
Created December 8, 2016 08:49
Update remote branch list
#!/bin/bash
git remote update origin --prune