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.
@onstatus
onstatus / beamerthemematerial.sty
Created September 15, 2017 10:53 — forked from walshc/beamerthemematerial.sty
Material Design Beamer theme.
% Copyright 2016 by Christoph Walsh
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
% Used material from:
% https://github.com/edasubert/beamerMaterialDesign and
% http://ctan.mackichan.com/macros/latex/contrib/beamer/base/themes/outer/beamerouterthememiniframes.sty