Skip to content

Instantly share code, notes, and snippets.

View azlux's full-sized avatar
🦊
.

azlux

🦊
.
View GitHub Profile
@azlux
azlux / py_progress_bar.py
Created June 20, 2016 14:52
Progress bar into the terminal in python3
def progress_bar(iteration, total, barLength=50):
percent = int(round((iteration / total) * 100))
nb_bar_fill = int(round((barLength * percent) / 100))
bar_fill = '#' * nb_bar_fill
bar_empty = ' ' * (barLength - nb_bar_fill)
sys.stdout.write("\r [{0}] {1}%".format(str(bar_fill + bar_empty), percent))
sys.stdout.flush()
def bar_example():
for i in range(20):
@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 / 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 / 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 / dns_update.sh
Created May 29, 2017 17:12
Update script for my dnsmasq to remove add
#!/bin/bash
# Address to send ads to (the RPi)
piholeIP="127.0.0.1"
# Config file to hold URL rules
eventHorizion="/etc/dnsmasq.d/adList.conf"
echo "Getting yoyo ad list..."
curl -s -d mimetype=plaintext -d hostformat=unixhosts http://pgl.yoyo.org/adservers/serverlist.php? | sort > /tmp/matter.txt
@azlux
azlux / proxmox.json
Last active November 2, 2019 03:45
Grafana Proxmox Containers Dashboard, screenshot : https://imgur.com/a/p2RVFXf
{
"__inputs": [
{
"name": "DS_OTHERS",
"label": "others",
"description": "",
"type": "datasource",
"pluginId": "influxdb",
"pluginName": "InfluxDB"
},
@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 / TZ3000_switch.yaml
Created July 7, 2022 15:52
HA blueprint for 2 buttons _TZ3000_dfgbtub0 zigbee (deconz) switch
blueprint:
name: TZ3000 2-Button Scene Switch
description: Manage TZ3000 switch, double buttons, simple/double/long press.
domain: automation
input:
2button_scene_switch:
name: TZ3000 switch
selector:
device:
manufacturer: _TZ3000_dfgbtub0