Skip to content

Instantly share code, notes, and snippets.

View mysticaltech's full-sized avatar

K. N. mysticaltech

  • Spain
View GitHub Profile
mysticaltech / docker-compose.yml
Created February 15, 2023 10:01 — forked from giggio/docker-compose.yml
Mirror Docker hub with Docker-compose
View docker-compose.yml
version: '3.7'
container_name: docker-registry-mirror
image: registry:2
- "443:443"
- ./data/docker/var/lib/registry:/var/lib/registry
- ./data/certs:/certs
mysticaltech /
Created December 2, 2022 22:58 — forked from ifeulner/
Longhorn hcloud best practices

Longhorn best practices

The following settings are provided as an example how longhorn should be configured in a production cluster, especially if it is deployed on Hetzner Cloud infrastructure.

Hetzner server nodes provide local storage and allow up to five attached volumes (with a size of up to 10TiB each) Local storage is provided by NVMe storage and therefore is much faster than the attached volumes, but limited in size (max 300GiB usable).

Initial configuration

Also you want to control the nodes that are used for storage. So it is suggested to set the option Create default disk only on labeled node to true

mysticaltech / rage-clicks.js
Created December 1, 2022 16:38 — forked from silversillu/rage-clicks.js
Tracking Rage Clicks using GTM
View rage-clicks.js
if ( typeof(jQuery) === 'function' ) {
jQuery(document).ready(function($) {
getPath: function() {
var path, node = this;
while (node.length) {
var realNode = node[0],
name = realNode.localName;
if (!name) break;
name = name.toLowerCase();
mysticaltech / gist:b66e9a5d7e25d0ef9c3afeb1650c30c9
Created October 26, 2022 23:50 — forked from koakh/gist:fbbc37cde630bedcf57acfd4d6a6956b
SurrealDB : How to use signin and signup (server + client nodesjs)
View gist:b66e9a5d7e25d0ef9c3afeb1650c30c9
**As a developer you have complete control over the signup and signin functionality...**
$ surreal sql --conn http://localhost:8000 --user root --pass root --ns test --db test
-- optional : this is the default see --ns test --db test start server flags
-- USE NS test DB test;
mysticaltech / gist:89204c7ec3dff2da1609505c55005525
Last active October 23, 2022 23:38
How to share an external drive via NFS on Fedora Linux for Kodi as a client
View gist:89204c7ec3dff2da1609505c55005525
1/ Install nfs-utils
sudo dnf install nfs-utils
2/ Enable the needed services
sudo systemctl enable rpcbind
sudo systemctl enable nfs-server
sudo service rpcbind start
sudo service nfs-server start
mysticaltech /
Created December 3, 2021 20:35 — forked from marshki/
One-way Rsync mirror of data from source to destination. Run as a crontab.
#!/usr/bin/env bash
# mirror_mirror
# One-way Rsync mirror of data from source to destination.
# Author: M. Krinitz <mjk235 [at] nyu [dot] edu>
# Date: 2020.04.20
# License: MIT
mysticaltech /
Created November 29, 2021 11:07 — forked from stucchio/
Bayesian A/B test code
from matplotlib import use
from pylab import *
from scipy.stats import beta, norm, uniform
from random import random
from numpy import *
import numpy as np
import os
# Input data
mysticaltech /
Created October 11, 2021 16:53 — forked from Lauszus/
Generic CRC-8, CRC-16 and CRC-32 calculations in Python
#!/usr/bin/env python
# Inspired by:
# The CRC values are verified using:
def reflect_data(x, width):
# See:
if width == 8:
x = ((x & 0x55) << 1) | ((x & 0xAA) >> 1)
x = ((x & 0x33) << 2) | ((x & 0xCC) >> 2)
x = ((x & 0x0F) << 4) | ((x & 0xF0) >> 4)
mysticaltech / gist:22f5ed5466c2372d69c82f5c743da3d6
Last active October 23, 2022 23:41
Cloudflare Warp on Linux Fedora
View gist:22f5ed5466c2372d69c82f5c743da3d6
Basically, to make it work and have it resolve DNS queries, you need to disable systemd-resolved as it monopolizes the /etc/resolv.conf file, more about this process here
sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved
sudo bash -c 'mkdir -p /etc/systemd/system-preset && echo "disable systemd-resolved.service" >/etc/systemd/system-preset/20-systemd-resolved-disable.preset'
Then reboot, and don't worry it is normal that you do not have internet at that point. We need to delete an old symlink left over from systemd-resolved operations.
rm /etc/resolv.conf
mysticaltech /
Created July 29, 2021 09:43 — forked from racitup/
Extract text from html in python using BeautifulSoup4
from bs4 import BeautifulSoup, NavigableString, Tag
def html_to_text(html):
"Creates a formatted text email message as a string from a rendered html template (page)"
soup = BeautifulSoup(html, 'html.parser')
# Ignore anything in head
body, text = soup.body, []
for element in body.descendants:
# We use type and not isinstance since comments, cdata, etc are subclasses that we don't want
if type(element) == NavigableString: