Skip to content

Instantly share code, notes, and snippets.

@shamil
shamil / mount_qcow2.md
Last active March 26, 2024 14:47
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@ruanbekker
ruanbekker / cheatsheet-elasticsearch.md
Last active March 20, 2024 02:45
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@mdonkers
mdonkers / server.py
Last active March 17, 2024 04:06
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
#!/usr/bin/env bash
# Installs/Configures:
# - Docker
# - Docker Registy Container with self-signed cert
#
# Tested on Ubuntu 14.04.1
# Must be executed with elevated privilages
if [ "$(id -u)" != "0" ]; then
@jeromer
jeromer / compassbearing.py
Last active February 21, 2024 13:31
compass bearing between two points in Python
# LICENSE: public domain
def calculate_initial_compass_bearing(pointA, pointB):
"""
Calculates the bearing between two points.
The formulae used is the following:
θ = atan2(sin(Δlong).cos(lat2),
cos(lat1).sin(lat2) − sin(lat1).cos(lat2).cos(Δlong))
@sinbad
sinbad / backup_gitea.sh
Created August 9, 2020 14:58
My Gitea Backup & Restore Scripts
#!/bin/bash
# `gitea dump` doesn't currently back up LFS data as well, only git repos
# It primarily backs up the SQL DB, and also the config / logs
# We'll backup like this:
# * "gitea dump" to backup the DB and config etc
# * tar / bzip all the repos since they will be skipped
# * Not rotated because git data is immutable (normally) so has all data
# * rsync LFS data directly from /volume/docker/gitea/git/lfs
# * No need for rotation since all files are immutable
@safebuffer
safebuffer / install.sh
Created September 7, 2021 10:00
Install FortiClient 7.0 VPN on Kali Linux
curl -p --insecure "http://ftp.br.debian.org/debian/pool/main/liba/libappindicator/libappindicator1_0.4.92-8_amd64.deb" --output libappindicator1_0.4.92-8_amd64.deb
curl -p --insecure "http://ftp.br.debian.org/debian/pool/main/libi/libindicator/libindicator7_0.5.0-4_amd64.deb" --output libindicator7_0.5.0-4_amd64.deb
wget https://filestore.fortinet.com/forticlient/downloads/forticlient_vpn_7.0.0.0018_amd64.deb
sudo dpkg -i libindicator7_0.5.0-4_amd64.deb
sudo apt-get install libdbusmenu-gtk4
sudo apt-get install libgconf-2-4
sudo dpkg -i libappindicator1_0.4.92-8_amd64.deb
sudo dpkg -i forticlient_vpn_7.0.0.0018_amd64.deb
@RafPe
RafPe / vyos-optimisations
Last active August 5, 2023 03:38
vyos throughput optimizations
Server 2 sockets,6 cores each, 2.4ghz
# Set ixgbe options
# Limit RSS queues to the number of physical cores per cpu
# Disable offload
# When you change this, you need to run the command and reboot for it to take.
echo "options ixgbe LRO=0,0 MQ=1,1 RSS=6,6 VMDQ=0,0 vxlan_rx=0,0" > /etc/modprobe.d/ixgbe.conf
# Shut down HT cores
for i in $(seq 1 2 23); do
/*
d8888 .d8888b. 888b 888
d88888 d88P Y88b 8888b 888
d88P888 888 888 88888b 888
.d8888b d88P 888 888 888Y88b 888
88K d88P 888 888 888 Y88b888
"Y8888b. d88P 888 888 888 888 Y88888
X88 d8888888888 Y88b d88P 888 Y8888
88888P' d88P 888 "Y8888P" 888 Y888