Skip to content

Instantly share code, notes, and snippets.

@onstatus
onstatus / Jellyfin-api-auth-example.py
Last active May 29, 2024 10:45 — forked from mcarlton00/Jellyfin-api-auth-example.py
Example for authenticating to Jellyfin API from Python
import requests
# Define connection details
server_url = 'http://192.168.0.200:8096'
username = 'User'
password = 'Password'
# Build json payload with auth data
auth_data = {
'username': username,
@onstatus
onstatus / nx2gt.py
Created November 22, 2020 12:11 — forked from bbengfort/nx2gt.py
Convert a networkx to graph-tool graph
import networkx as nx
import graph_tool as gt
def get_prop_type(value, key=None):
"""
Performs typing and value conversion for the graph_tool PropertyMap class.
If a key is provided, it also ensures the key is in a format that can be
@onstatus
onstatus / nx2gt.py
Created November 22, 2020 12:11 — forked from bbengfort/nx2gt.py
Convert a networkx to graph-tool graph
import networkx as nx
import graph_tool as gt
def get_prop_type(value, key=None):
"""
Performs typing and value conversion for the graph_tool PropertyMap class.
If a key is provided, it also ensures the key is in a format that can be
@onstatus
onstatus / capp_treemaps.py
Created August 4, 2020 15:18 — forked from gVallverdu/capp_treemaps.py
Treemaps with python and matplotlib
#!/usr/bin/env python3
# coding: utf-8
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import squarify
import platform
# print versions
@onstatus
onstatus / gist:559fbdbffd6e8a974c829331ec4e3cab
Created May 27, 2020 19:50 — forked from julianlam/expose-directory-on-host-to-lxc-container.md
Exposing a directory on the host machine to an LXC container

Exposing a directory on the host machine to an LXC container

  1. Log into the container and create an empty directory, this will be the mount point
  2. Log out and stop the container.
  3. Open to your container's config file
    • For regular LXC containers: /var/lib/lxc/mycontainer/config
    • For unprivileged LXC containers: $HOME/.local/share/lxc/mycontainer/config
  4. Add a new line above the lxc.mount directive, that follows the format below. Substitute proper paths as necessary:
    • lxc.mount.entry = /path/to/folder/on/host /path/to/mount/point none bind 0 0
  • Both of these paths are relative to the host machine.
#! /bin/bash
domain=domain.tld
[email protected]
yum -y update; yum install git openssl
cd /srv
if [ -d letsencrypt ]
then
cd letsencrypt && git pull
else
git clone https://github.com/letsencrypt/letsencrypt && cd letsencrypt
# Based on Monitoring Postfix and Dovecot logs in ELK
# https://blog.tinle.org/2015/06/19/monitoring-postfix-and-dovecot-logs-in-elk/
# Syslog Stuff
COMPONENT ([\w._\/%-]+)
COMPID postfix\/%{COMPONENT:component}(?:\[%{NUMBER:pid}\])?
POSTFIX (?:%{SYSLOGTIMESTAMP:timestamp}|%{TIMESTAMP_ISO8601:timestamp8601}) (?:%{SYSLOGFACILITY} )?%{SYSLOGHOST:logsource} %{COMPID}:
# POSTFIX %{SYSLOGTIMESTAMP:timestamp} %{SYSLOGHOST:hostname} %{COMPID}: %{QUEUEID:queueid}
# POSTFIX_MESSAGE %{SYSLOGTIMESTAMP:timestamp} %{IPORHOST:host} %{DATA:program}/%{DATA:subprog}\[%{NUMBER:pid}\]: %{POSTFIX_QUEUEID:queueid}:
echo "[Config] Installing archlinuxfr"
echo >> /etc/pacman.conf<<EOF
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
EOF
echo "[Update] Updating repositories"
pacman -Sy
@onstatus
onstatus / ksk_checker.py
Last active November 4, 2019 16:25
Script to check DNSSEC validation chain using getdns python binding and saving result in influxdb
import getdns
import datetime
import time
from influxdb import InfluxDBClient
from influxdb.client import InfluxDBClientError
DBUSER = 'influx_dbuser'
DBPASSWORD = 'influx_dbpass'
#/etc/raddb/sites-enabled/default
[...]
# Post-Authentication
# Once we KNOW that the user has been authenticated, there are
# additional steps we can take.
post-auth {
[...]
#
# Un-comment the following if you want to modify the user's object
# in LDAP after a successful login.