Skip to content

Instantly share code, notes, and snippets.

@pierew
pierew / recover_nextcloud_vcards.py
Created August 17, 2022 21:26
recover-nextcloud-vcards
db = pymysql.connect(host="localhost",user="root",password="****",database="nextcloud",cursorclass=pymysql.cursors.DictCursor)
with db:
with db.cursor() as cursor:
sql = "SELECT carddata,uri FROM oc_cards WHERE addressbookid='5';"
cursor.execute(sql)
result = cursor.fetchall()
for item in result:
vcard = open("/tmp/restored_vcards/"+item["uri"],"w")
vcard.write(item["carddata"].decode("utf-8"))
vcard.close()
@pierew
pierew / deployment-azure-app-service.yml
Last active September 18, 2021 19:58
GitHub Actions - Docker Image and Publish to Azure App Service
name: Azure App Service CD
on:
workflow_dispatch:
registry_package:
types:
- updated
- published
jobs:
@pierew
pierew / pve-autosnapshot.sh
Created September 3, 2020 19:48
Proxmox VE Autosnapshot
#!/bin/bash
TODAY_DAY=$(date +%a | tr '[:upper:]' '[:lower:]')
echo "Reading Container in /pools/LXC-Backup"
for VMID in $(pvesh get /pools/LXC-Backup/ --output-format json-pretty | jq '.members | .[].vmid');
do
if [[ $(pct list | grep $VMID) == *"$VMID"* ]]
then
echo "CT $VMID - Delete Snapshot"
pct delsnapshot $VMID "auto_snap_$TODAY_DAY"
@pierew
pierew / haproxy.conf
Created August 8, 2020 08:20
TCP Mode port-forwarding
frontend private-tcp
bind 10.147.17.42:80
mode tcp
default_backend private-pfsense
frontend private-tcp-ssl
bind 10.147.17.42:443
mode tcp
default_backend private-pfsense-ssl
@pierew
pierew / pvenode-rename
Created February 18, 2019 19:07
Changing a Proxmox VE Nodes name when it is not in a cluster
OLDNAME=$(hostname)
hostnamectl set-hostname ${1}
mkdir -p /etc/pve/nodes/${1}
cp -a /etc/pve/nodes/${OLDNAME} /etc/pve/nodes/${1}
echo 'A reboot is required, Exit with CTRL-C'
read
@pierew
pierew / sentry-cron.service
Last active November 1, 2018 21:24
Sentry Active-Passive HA on Linux CentOS 7
[Unit]
Description=Sentry Cron Container
After=docker.service
[Service]
Restart=always
ExecStart=/usr/bin/docker start -a sentry-cron
ExecStop=/usr/bin/docker stop sentry-cron
[Install]
@pierew
pierew / dockerconnect
Last active October 17, 2018 19:20
Docker in Docker Isolation for cheap
if [[ $(docker inspect -f {{.State.Running}} $USER 2>/dev/null) ]]; then
docker exec -it $USER /bin/sh
else
echo "Initializing your Docker Environment..."
docker run --name $USER --privileged -d docker:dind
sleep 1
docker exec -it $USER /bin/sh
fi
@pierew
pierew / Generate-PanDoc.ps1
Created August 20, 2017 20:39
Generating PanDoc HTML Conversion in actual Directory
If (Test-Path "$(Get-Location)\pandoc_html") {
Remove-Item -Recurse "$(Get-Location)\pandoc_html" -Force
}
New-Item -Path "$(Get-Location)\pandoc_html" -ItemType directory
Get-ChildItem "$(Get-Location)\*.md" | ForEach-Object {
pandoc $_ -f markdown -t html -s -o "$(Get-Location)\pandoc_html\$($_.BaseName).html" | Out-Null
}
@pierew
pierew / smb.conf
Created January 23, 2017 20:02 — forked from skarllot/smb.conf
Linux Samba access-based enumeration
. . .
[Share]
. . .
hide unreadable = yes
hide unwriteable files = yes
. . .
@pierew
pierew / mirror-raspberrypi-archive.sh
Created October 31, 2016 22:21
How To Mirror archive.raspberrypi.org - Define which folders by changing and Adding Lines, it will add recursive
#!/bin/bash
cd <INSERT FOLDER TO DOWNLOAD TO>
# LOAD GPG KEY
echo "Loading GPG Key..."
wget http://archive.raspberrypi.org/debian/raspberrypi.gpg.key
# LOAD JESSIE
echo "Loading dists/jessie..."
wget -nv --progress=bar -N -m --no-parent --cut-dirs=1 --reject "*.html*" http://archive.raspberrypi.org/debian/dists/jessie/