Skip to content

Instantly share code, notes, and snippets.

View M0r13n's full-sized avatar
🦔

Leon Morten Richter M0r13n

🦔
View GitHub Profile
@M0r13n
M0r13n / capsman.md
Last active April 10, 2022 13:52
Configure Mikrotik CAPsMAN with CHATEAU and Audience

Configure Mikrotik CAPsMAN with CHATEAU and Audience

I am assuming that your Chateau has loaded it's default config. If so:

  • bridge and lte interface are already configured correctly
  • also the DHCP server is already setup (192.168.88.2 - 192.168.88.254)
  • NAT is also already configured

Setup CAPsMAN

@M0r13n
M0r13n / doh
Last active May 7, 2024 19:03
Setup Cloudflare as a DoH (DNS over HTTPS) resolver on Mikrotik devices (RouterOS v7.0.2+)
# Temporarily add a normal upstream DNS resolver
/ip dns set servers=1.1.1.1,1.0.0.1
# CA certificates extracted from Mozilla
/tool fetch url=https://curl.se/ca/cacert.pem
# Import the downloaded ca-store (127 certificates)
/certificate import file-name=cacert.pem passphrase=""
# Set the DoH resolver to cloudflare
@M0r13n
M0r13n / main.py
Created May 17, 2021 10:47
Related mapping examle
#!/usr/bin/python
import json
from enum import Enum
import related
from attr import attrib
from related import to_model, TypedSequence
class Files(Enum):
@M0r13n
M0r13n / bar.py
Created December 7, 2020 08:31
A simple Progress Bar in Python without external dependencies.
"""
Dynamic Progressbar in Python without external dependencies
"""
import sys
import time
from typing import TextIO, Iterable
class ProgressBar(object):
"""
This is a simple context-manager that stores information about already written files on the file system.
The idea is to keep track of files that have already been written and that have not changed.
The benefit is, that we do not need to generate the code for things, that already exist and are up to date.
Because we do not know how the generated code would look like and what files are generated,
we can need to store such information in a separate file.
Basically we check for every generator, if it needs to be generated.
@M0r13n
M0r13n / wsl.md
Created October 21, 2020 09:10
Installation des Windows Subsystems (WSL) ohne den Microsoftstore. Nützlich in Enterprise Umgebungen.

WSL Installation

Das WSL kann ohne den MicrosoftStore installiert werden. Dazu müssen zwei Dinge geschehen. Zum einen muss in Windows die Unterstützung für das WSL aktiviert werden und anschließend muss das WSL installiert werden.

Vorraussetzungen

Die Anleitung richtet sich an die zweite Version (WSL-2) des Subsystems. Daher wird ein Windows 10 Version 1903 oder höher mit Build 18362 oder höher benötigt.

Aktivierung WSL

Bitte folge der offiziellen Anleitung bis ausschließlich Schritt 6:

Installation WSL

@M0r13n
M0r13n / dotdict.py
Created October 11, 2020 14:32
A simple Python dictionary whose keys can be queried using dot notation.
from typing import Any
class CaseInsensitiveDict(dict):
"""
A dict object where the case of keys does not matter.
Create a new instance:
>>> c = CaseInsensitiveDict({'a' : 123})
@M0r13n
M0r13n / cert.pem
Last active September 14, 2020 14:59
Requests foo
-----BEGIN CERTIFICATE-----
MIIKuTCCCaGgAwIBAgIMIKnT34vOStDMr3hOMA0GCSqGSIb3DQEBCwUAMIGNMQswCQYDVQQGEwJERTFFMEMGA1UECgw8VmVyZWluIHp1ciBGb2VyZGVydW5nIGVpbmVzIERldXRzY2hlbiBGb3JzY2h1bmdzbmV0emVzIGUuIFYuMRAwDgYDVQQLDAdERk4tUEtJMSUwIwYDVQQDDBxERk4tVmVyZWluIEdsb2JhbCBJc3N1aW5nIENBMB4XDTE5MDMxNDEzMjU0MFoXDTIxMDYxNTEzMjU0MFowgbkxCzAJBgNVBAYTAkRFMRswGQYDVQQIDBJTY2hsZXN3aWctSG9sc3RlaW4xDTALBgNVBAcMBEtpZWwxMTAvBgNVBAoMKENocmlzdGlhbi1BbGJyZWNodHMtVW5pdmVyc2l0YWV0IHp1IEtpZWwxITAfBgNVBAsMGEluc3RpdHV0IGZ1ZXIgSW5mb3JtYXRpazEoMCYGA1UEAwwfYnVrYXJlc3QuaW5mb3JtYXRpay51bmkta2llbC5kZTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMnBSHNRepsZOgKDk2IhzJ5V2jgvZuMAS635ixOUhgxeHemo9xHHXq6aXre3Enr0DXDr1tJ61Bi2gVcbT3SO1G5GRguLtdRhf+Qpiipf7GOwJDZv+lWiqEhXo8cesoZt4EjwLkd7MIy+kHpcVUtBJ+mcx7QrYI4Qu/pEtPY1XgNG2EdKkcE+6+fEJI1t5m2jdDNcZuV6E/nkHBZk1KVJuyRVsnnTR2HZY2IFV/ndH0koJMW+o2PA/iowBogMS/o13A0zmquCWV8oUH/NV0fZtuahA60uR6CIFUy6ov+eg6jKLlg/O8mQmNYcRnk7UJZ1lneFZ2/9g86a0yQE7A72XbW6jPtxXb35tv9UC0IosXm+wgO5rVeoQBaw534fe6l/NvbfTMyA1TnLMapIuAhbXMCTamYF
@M0r13n
M0r13n / index.html
Created September 2, 2020 14:57
Recursive Multilevel, nested and numbered lists from JSON. This includes checkboxes that also check or un-check their child checkboxes on click.
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" type="text/css" href="./style.css">
<title>Test</title>
</head>
@M0r13n
M0r13n / README.md
Created July 11, 2020 09:15
Oneliner to delete Systemd service (systemctl) in bash.

Oneliner to delete a Systemd service

service=YOUR_SERVICE_NAME; systemctl stop $service && systemctl disable $service && rm /etc/systemd/system/$service &&  systemctl daemon-reload && systemctl reset-failed

Set service to your desired service that should be deleted. E.g. service=gunicorn.service