Python

xmlsec/xmlsec1 In Heroku Python

Submitted by gpmidi on Thu, 02/27/2020 - 21:24

Need xmlsec (aka xmlsec1) working in Heroku's Python? Try this: 

  1. Install buildpack: heroku buildpacks:add --index 1 heroku-community/apt
    1. This needs to be before the Python buildpack. You can validate that in the settings tab now days. 
  2. Create an Aptfile in the root of your project and add:
    1. libxml2-dev
      libxml2
      libxmlsec1-dev
      libxmlsec1
      libxmlsec1-openssl
      build-essential
      libxml2-utils
      xmlsec1
  3. Commit & Push!

Stupid Simple Python Script For Working With System vs ZFS Disks

Submitted by gpmidi on Thu, 10/10/2019 - 09:42

This script helps identify what disks are in use (or not in use) by ZFS. It's a stupid-simple python 3 script that requires only 'sh'. You can get that via 'pip3 install sh'. 

#!/usr/bin/python3
import re
from sh import zpool,lsblk,ls
from pprint import pprint

print("Finding all disks")
sdisks = str(lsblk('-d').stdout)
# sdbl  67:240  0   7.3T  0 disk
alldisks = re.findall(r'(sd[a-z]+)\s+\d+:\d+\s+\d+\s+(.*?)\s+\d+\s+disk',sdisks,re.MULTILINE)
print("Found %d disks on system"%len(alldisks))

Tags