Skip to content

Instantly share code, notes, and snippets.

View kkroesch's full-sized avatar

Karsten Kroesch kkroesch

View GitHub Profile
@kkroesch
kkroesch / weathermap.go
Last active January 15, 2024 18:46
Get Weather Data from Open Weather Map.
package main
import (
"encoding/json"
"fmt"
"net/http"
"os"
"time"
)
@kkroesch
kkroesch / mkvm.sh
Last active January 9, 2024 13:02
Create VM via Proxmox VM Command Line Tools
## Get cloud image
cd /storage
wget https://cloud-images.ubuntu.com/lunar/current/lunar-server-cloudimg-amd64.img
## Create and configure Machine
qm create 101 --name ubuntu-lunar-template --memory 512 --net0 virtio,bridge=vmbr0
qm importdisk 101 /storage/lunar-server-cloudimg-amd64.img VDI -format qcow2
qm set 101 --scsihw virtio-scsi-pci --scsi0 VDI:vm-101-disk-0
qm set 101 --ide2 local:cloudinit --boot c --bootdisk scsi0 --serial0 socket --vga serial0
@kkroesch
kkroesch / gist:9d789b6d81d0ceeab48f24da9fe049f3
Created January 3, 2024 08:23
Extract all URLs from Brave Bookmarks
# Windows:
cd C:\Users\kkroesch\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default
# Linux
cd $HOME/.config/BraveSoftware/Brave-Browser/Default/
jq '[recurse(.[]?) | select(type == "object" and .children != null) | .children[] | {date_added, name, url}] | {bookmark: .}' Bookmarks > bookmarks.json
@kkroesch
kkroesch / Containerfile
Last active October 31, 2023 15:31
Container for Python Developers
FROM ubuntu:latest
# Setzen Sie die Umgebungsvariablen für den Proxy (falls erforderlich)
#ENV HTTP_PROXY=http://httpproxy.ag.ch:8080
#ENV HTTPS_PROXY=http://httpproxy.ag.ch:8080
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python3 python3-pip python3-venv python3-nose python3-dev python3-numpy python3-plotly python3-ipython ipython3 \
vim exa git build-essential zsh curl \
net-tools dnsutils nmap mtr iftop
@kkroesch
kkroesch / get_certificate.sh
Created October 26, 2023 15:16
HAProxy Certbot
DOMAIN=$1
certbot certonly \
--standalone -d "$DOMAIN" \
--email "helpdesk@$DOMAIN"
--non-interactive \
--agree-tos \
--http-01-port=8899
@kkroesch
kkroesch / copyright.sh
Created October 26, 2023 14:31
Put a copyright notice on JPEG pictures
@kkroesch
kkroesch / jail.conf
Created October 16, 2023 11:06
Fail2ban filter 404-requests (unsolicited pentests) for Nginx
# in /etc/fail2ban/jail.conf
# ...
[nginx-4xx]
enabled = true
port = http,https
filter = nginx-4xx
logpath = /var/log/nginx/access.log
bantime = 3600
@kkroesch
kkroesch / webconsole.service
Last active October 30, 2023 13:51
Example systemd config for web application
a# /etc/systemd/system/webconsole.service
#
# Install with:
# # install https://github.com/yudai/gotty
# # systemctl daemon-reload
# # systemctl enable --now patchstatus.service
#
[Unit]
Description=Provide an ephemeral container with web console
@kkroesch
kkroesch / haproxy.cfg
Created June 22, 2023 10:34
HAProxy example config with tunneled SSH service
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin expose-fd listeners
stats timeout 30s
user haproxy
group haproxy
daemon
@kkroesch
kkroesch / kix_api.http
Created March 14, 2022 14:05
Kix REST API
### Requests for Kix API
@base_url = http://localhost:20000/api/v1
### Authorization
# @name request_auth_token
POST {{base_url}}/auth
{