This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<LoadPlugin python> | |
Globals true | |
</LoadPlugin> | |
<Plugin python> | |
ModulePath "/path/to/write_null" # write_null is a folder with an __init__.py inside | |
LogTraces true | |
Import "write_null" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import subprocess | |
import re | |
def containers(): | |
lxcOutput = subprocess.check_output( ['lxc', 'list' ] ) | |
ips = re.compile( '\d+\.\d+\.\d+\.\d+' ).findall( str( lxcOutput ) ) | |
nodes = dict( hosts = ips, vars = { "ansible_user": "root" } ) | |
inventory = dict( nodes = nodes ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo add-apt-repository ppa:webupd8team/java | |
sudo apt-get update | |
sudo apt-get install oracle-java8-installer | |
sudo apt-get install oracle-java8-set-default | |
java -version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include mime.types; | |
upstream NAME_OF_SERVICE { | |
server localhost:1905; | |
} | |
server { | |
listen 80; | |
rewrite ^(.*) https://$host$1 permanent; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Route: | |
def __init__(self, cidr): | |
self._address, mask_bits = cidr.split('/') | |
mask_bits = int(mask_bits) | |
self._mask = 0xffffffff & (0xffffffff << (32 - mask_bits)) | |
self._mask_bits = mask_bits | |
self._address_number = self.number(self._address) | |
self._hex_address = self._hex4(self._address_number) | |
def __repr__(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function yaml_validate { | |
python -c 'import sys, yaml, json; yaml.safe_load(sys.stdin.read())' | |
} | |
function yaml2json { | |
python -c 'import sys, yaml, json; print(json.dumps(yaml.safe_load(sys.stdin.read())))' | |
} | |
function yaml2json_pretty { | |
python -c 'import sys, yaml, json; print(json.dumps(yaml.safe_load(sys.stdin.read()), indent=2, sort_keys=False))' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_reset_audio() { | |
systemctl --user restart pipewire-pulse.service | |
systemctl --user restart pipewire.service | |
} |