Skip to content

Instantly share code, notes, and snippets.

View plehr's full-sized avatar
💭
Working from sea 🌊

Pascal plehr

💭
Working from sea 🌊
View GitHub Profile
@plehr
plehr / VIM
Last active December 13, 2016 20:21
:%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
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';
@plehr
plehr / UTF-8 HEX
Last active May 5, 2018 17:14
Für HomeMatic-Skript-Nachrichten
Ä : %C3%84
ä : %C3%A4
Ö : %C3%96
ö : %C3%B6
Ü : %C3%9C
ü : %C3%BC
, : %2C
Leerzeichen : %C2%A0
@plehr
plehr / install.sh
Last active May 9, 2018 14:21
DigitalOcean Maschine mit NPM
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 / keybase.md
Created June 4, 2018 13:15
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 / abgabe
Last active January 15, 2019 15:37
Tiny bash script to zip java files and compile it to check zip file. Include warning against german special character
#!/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
@plehr
plehr / OktaUpdateIpZone.sh
Created February 27, 2019 12:35
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.
#!/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 / gist:9553c1f24a5aff56a7d4e977e3105351
Created November 29, 2019 10:15
ORACLE clear database
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 / viewCOVID19.sh
Last active October 13, 2020 10:09
Zeige alle COVID-19 Fälle in meinem Landkreis
#!/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)}'
@plehr
plehr / install.sh
Last active September 21, 2021 08:37
school project syncthing
#!/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