Skip to content

Instantly share code, notes, and snippets.

View azlux's full-sized avatar
🦊
.

azlux

🦊
.
View GitHub Profile
@azlux
azlux / dyndns.sh
Created February 7, 2025 09:50
OVH DynDNS ipv4 and ipv6
#! /usr/bin/env bash
set -e # abort on nonzero exitstatus
set -u # abort on unbound variable
set -o pipefail # don't hide errors within pipes
TIME_START=$(date +%s%3N)
[ -z "$DYNDNS_LOGIN" ] && echo "missing variable DYNDNS_LOGIN"
[ -z "$DYNDNS_PASSWORD" ] && echo "missing variable DYNDNS_PASSWORD"
@azlux
azlux / markdown_doc
Last active September 7, 2018 12:10 — forked from jiffyclub/markdown_doc
This script turns Markdown into HTML using the Python markdown library and wraps the result in a complete HTML document with default Bootstrap styling so that it's immediately printable. Requires the python libraries jinja2, markdown, and mdx_smartypants.
!/usr/bin/env python3
import argparse
import sys
import jinja2
import markdown
import re
TEMPLATE = """<!DOCTYPE html>
@azlux
azlux / mumble-ping.py
Created January 6, 2017 17:10
Mumble ping to have users, ping and bandwidth of a server
import socket
from struct import pack, unpack
import datetime
###
# Work based on https://bitbucket.org/Svedrin/k10-plugins/src/tip/BwCalc/plugin.py?fileviewer=file-view-default#cl-120
###
def mumble_ping(host, port=64738):
@azlux
azlux / spinner.txt
Last active March 25, 2021 13:37
spinner list for program
dots = ("⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏")
dots2 = ("⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷")
dots3 = ("⠋","⠙","⠚","⠞","⠖","⠦","⠴","⠲","⠳","⠓")
dots4 = ("⠄","⠆","⠇","⠋","⠙","⠸","⠰","⠠","⠰","⠸","⠙","⠋","⠇","⠆")
dots5 = ("⠋","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋")
dots6 = ("⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠴","⠲","⠒","⠂","⠂","⠒","⠚","⠙","⠉","⠁")
dots7 = ("⠈","⠉","⠋","⠓","⠒","⠐","⠐","⠒","⠖","⠦","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈")
dots8 = "⠁","⠁","⠉","⠙","⠚","⠒","⠂","⠂","⠒","⠲","⠴","⠤","⠄","⠄","⠤","⠠","⠠","⠤","⠦","⠖","⠒","⠐","⠐","⠒","⠓","⠋","⠉","⠈","⠈")
dots9 = ("⢹","⢺","⢼","⣸","⣇","⡧","⡗","⡏")
dots10 = ("⢄","⢂","⢁","⡁","⡈","⡐","⡠")
@azlux
azlux / Warning_IPTABLES.md
Last active March 7, 2022 11:08
Sécurité avec iptables et l'option RELATED

Problème d'ouvertue de port non désirée sur une configuration IPTABLES

Un problème de contournement des règles iptables fixées par utilisateur peut survenir avec l’utilisation de règles iptables RELATED,ESTABLISH trop générique et le chargement de helper de service non présent ou non utilisé sur la machine (exemple FTP actif, SIP, IRC …).

True fact: Mon server MariaDB s'est fait attaqué comme ça alors que le port dans l'iptable n'était pas ouvert.


Menu

  1. Rappel
@azlux
azlux / py_progress_bar.py
Last active February 7, 2025 15:47
Progress bar into the terminal in python3
def progress_bar(current, total, bar_length=50):
percent = int(round((current / total) * 100))
nb_bar_fill = int(round((bar_length * percent) / 100))
bar_fill = '#' * nb_bar_fill
bar_empty = ' ' * (bar_length - nb_bar_fill)
sys.stdout.write(f"\r [{str(bar_fill + bar_empty)}] {percent}% ({current}/{total}) ")
sys.stdout.flush()
def bar_example():
for i in range(20):