Skip to content

Instantly share code, notes, and snippets.

View cernoel's full-sized avatar
🍉
One in a mellon!

Markus Gombocz cernoel

🍉
One in a mellon!
View GitHub Profile
@cernoel
cernoel / import_export_csv_timescale_docker.sh
Last active February 8, 2025 19:04
Some scripts for import, export, ... stuff in timescale
copy_chart_to_csv_gz() {
local _backupdir=/var/lib/postgresql/data/backup
mkdir -p $_backupdir
# user internal path to store gzipped csv
docker exec -t --user=postgres $CONTAINER_NAME psql \
--username="${POSTGRES_USER}" \
--dbname="${POSTGRES_DB}" \
--command="\COPY stocks.chart TO PROGRAM 'gzip > /var/lib/postgresql/data/backup/stocks.chart.csv.gz' WITH delimiter AS ',' CSV HEADER;"
@cernoel
cernoel / nginx_limit_except_get.conf
Created January 20, 2025 09:24
Example of limit except get, where only get is allowed publicy, and allow certain IPs to use other http methods
server {
server_name SERVICE.MY.DOMAIN;
listen 443 ssl;
ssl_certificate /etc/ssl/private/MY.DOMAIN/server.crt;
ssl_certificate_key /etc/ssl/private/MY.DOMAIN/server.key;
# block anything except /v2/*
if ($request_uri !~ ^/$|^/v2/) { return 403; }
@cernoel
cernoel / consul-api-consul-passing.yml
Created December 5, 2024 14:03
gatus - check consul service via consul api if check is passing
endpoints:
- name: check consul-service passing
ui:
hide-hostname: true
group: consul-service-api
url: "http://consul.service.dev.consul:8500/v1/health/service/consul?filter=Checks.Status%21%3d%22passing%22"
method: "GET"
interval: 30s
conditions:
- "[STATUS] == 200"
@cernoel
cernoel / gatus-consul-dns-check.yml
Last active December 5, 2024 14:04
Gatus - check a consul service via dns
endpoints:
- name: "consul service check - consul"
group: "consul service dns"
url: "consul.service.dev.consul:8600" # Address of the DNS server to use
dns:
query-name: "consul.service.dev.consul"
query-type: "A"
interval: 30s
conditions:
- "[DNS_RCODE] == NOERROR"
@cernoel
cernoel / create-proxmox-cloudinit-template.sh
Created September 23, 2024 13:50
This is just a starter cloud-init template generator to begin with for proxmox.
#!/bin/bash
# get new image if file does not exist
if [[ ! -f debian-12-genericcloud-amd64.qcow2 ]]; then
#rm debian-12-genericcloud-amd64.qcow2
wget https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-genericcloud-amd64.qcow2
#sha check
fi;
# create vendor-cloudinit-template
@cernoel
cernoel / config.json
Last active January 23, 2025 11:01
zot config with ui enabled and docker as upstream repo
{
"distSpecVersion":"1.1.0-dev",
"storage":{
"dedupe": true,
"gc": true,
"gcDelay": "1h",
"gcInterval": "6h",
"rootDirectory":"/data/zot/"
},
"http": {
@cernoel
cernoel / quick_hosts_check.sh
Created September 5, 2023 07:08
quickly check local hosts
#!/bin/bash
HOST_IF="eth0"
RANGE="24"
if [ "x$1" != "x" ]; then
HOST_IF="$1"
fi
if [ "x$2" != "x" ]; then
@cernoel
cernoel / run.sh
Last active May 31, 2023 13:54
(unsecure, easy) Makefile alternative for sh
#!/bin/sh
set -e
DEFAULT=help
#########################
## your functions here ##
# #
help() {

Keybase proof

I hereby claim:

  • I am cernoel on github.
  • I am cernoel (https://keybase.io/cernoel) on keybase.
  • I have a public key whose fingerprint is 3B7A 5091 B463 D18E 5A56 4A7F 13F7 C61B 7A60 4358

To claim this, I am signing this object:

@cernoel
cernoel / gist:f00e404b2544f8daec7b7e8bfbad5805
Created November 6, 2022 21:34
wg-meshconf bash array mesh configger
#!/bin/bash
# requirements:
# * ssh root access to servers
# * wireguard tools installed
# * https://github.com/k4yt3x/wg-meshconf .. installed on your config machine
declare -a Servers=("ora-fra-one" "ora-fra-two" "ora-fra-three" "ora-ams-one" "ora-ams-two")