Skip to content

Instantly share code, notes, and snippets.

@plehr
plehr / install.sh
Last active Sep 21, 2021
school project syncthing
View install.sh
#!/bin/bash
# #!/bin/bash;wget https://gist.githubusercontent.com/plehr/31fba0a01b5b248db3abb854712eb9ce/raw/install.sh ; sh -x install.sh
# bash <(curl -s https://gist.githubusercontent.com/plehr/31fba0a01b5b248db3abb854712eb9ce/raw/install.sh)
apt-get update -y;
apt-get install curl apt-transport-https htop xmlstarlet diffutils apache2-utils gnupg wget -y
curl -s https://syncthing.net/release-key.txt | apt-key add -
echo "deb https://apt.syncthing.net/ syncthing release" > /etc/apt/sources.list.d/syncthing.list
apt-get update -y
apt-get install syncthing -y
useradd -m syncworker
@plehr
plehr / viewCOVID19.sh
Last active Oct 13, 2020
Zeige alle COVID-19 Fälle in meinem Landkreis
View viewCOVID19.sh
#!/bin/bash
# Dieses Skript benoetigt jd, curl und awk
curl -s "https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?where=%20GEN%20%3D%20'BERLIN'&outFields=GEN,BEZ,EWZ,death_rate,cases,deaths,cases_per_100k,cases_per_population,BL,last_update,cases7_per_100k,county&outSR=4326&f=json" | jq '.features' |jq '.[].attributes.cases7_per_100k' | awk '{print int($1+0.5)}'
View gist:9553c1f24a5aff56a7d4e977e3105351
BEGIN
FOR table_ IN (SELECT table_name FROM all_tables WHERE OWNER='MS2') LOOP
execute immediate 'DROP TABLE ' || table_.table_name || ' CASCADE CONSTRAINTS';
END LOOP;
END;
@plehr
plehr / OktaUpdateIpZone.sh
Created Feb 27, 2019
If you would like to use Okta with a dynamic IP-Addr you need to update the IP manually or use this tiny script to do this by cronjob.
View OktaUpdateIpZone.sh
#!/bin/bash
api_token=<INSERT YOUR API KEY>
curl --silent -X PUT \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: SSWS ${api_token}" \
-d '{
"type": "IP",
"id": "<ZONE-ID>",
@plehr
plehr / abgabe
Last active Jan 15, 2019
Tiny bash script to zip java files and compile it to check zip file. Include warning against german special character
View abgabe
#!/bin/bash
## Tiny bash script to check files (maybe sourcecode?) against special characters.
## Author: plehr.de
echo "Executed:" >output.log
date >> output.log
echo " - - - - - - - - - Start Pre-Check - - - - - - - - -" | tee -a output.log
fgrep -Fn 'ä' *java | tee -a output.log
fgrep -Fn 'Ä' *java | tee -a output.log
fgrep -Fn 'ö' *java | tee -a output.log
View keybase.md

Keybase proof

I hereby claim:

  • I am plehr on github.
  • I am plehr (https://keybase.io/plehr) on keybase.
  • I have a public key whose fingerprint is 9DEF 4BA2 F675 9E60 F1C2 F428 6286 B8AF 9C9F B801

To claim this, I am signing this object:

@plehr
plehr / install.sh
Last active May 9, 2018
DigitalOcean Maschine mit NPM
View install.sh
apt-get update
apt-get install -y curl unzip wget htop zip git
curl -sL https://deb.nodesource.com/setup_8.x | bash -
apt-get install -y nodejs
npm install -g hexo-cli
ssh-keygen -t rsa -b 4096
@plehr
plehr / UTF-8 HEX
Last active May 5, 2018
Für HomeMatic-Skript-Nachrichten
View UTF-8 HEX
Ä : %C3%84
ä : %C3%A4
Ö : %C3%96
ö : %C3%B6
Ü : %C3%9C
ü : %C3%BC
, : %2C
Leerzeichen : %C2%A0
View Google Drive API calls for PHP
function newfolder($drive_service){
$fileMetadata = new Google_Service_Drive_DriveFile(array(
'name' => 'Testordner',
'mimeType' => 'application/vnd.google-apps.folder'));
$file = $drive_service->files->create($fileMetadata, array(
'fields' => 'id'));
printf("Folder ID: %s\n", $file->id); }
function ($drive_service) {
$folderId = 'xxxxxxxxxxx';
View VIM
:%g!/price/d <- Alle Zeilen entfernen, welche NICHT price enthalten
:%g/price/d <- Alle Zeilen entfernen, welche price enthalten
:%s/">//g <- Alle Zeichen "> durch nichts ersetzen