Skip to content

Instantly share code, notes, and snippets.

Mark Biggers biggers

Block or report user

Report or block biggers

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@biggers
biggers / py_syslog_dict_config.py
Last active Jul 30, 2019
Python dictConfig logging example using SyslogHandler - modified from Stackoverflow answer
View py_syslog_dict_config.py
import logging
import sys
from logging import config
# REF, modified from:
# https://stackoverflow.com/a/19367225
if sys.platform == "darwin":
address = '/var/run/syslog'
facility = 'local1'
@biggers
biggers / LinuxLVM.sh
Created Sep 1, 2017
simple Linux volume mgmt example / recipe(s) - LVM
View LinuxLVM.sh
-*-sh-*-
Various bits, pieces, notes -- on using Linux Volume (Disk) Mgmt,
on various Linux distros
"A Debian Grimoire - LVM: Logical Volume Management, Version 2"
http://deb.riseup.net/storage/lvm2/
@biggers
biggers / csv_summary_to_sql.py
Created Aug 14, 2017
How-to use the PyMySQL module for Python3 DB-API, working simple example (need a SQL table created, first)
View csv_summary_to_sql.py
import pymysql.cursors
import os
from attrdict import AttrDict
import sys
# Test a one-row Insert, Select for Capacity DB
# ... using Py DB-API
#
# Install:
# pip3 install PyMySQL attrdict
@biggers
biggers / async_threadpool_blocking_fn.py
Created Aug 10, 2017
async Python3 code using blocking-function
View async_threadpool_blocking_fn.py
from concurrent.futures import ThreadPoolExecutor, as_completed
import time
import random
TPOOL_SIZE = 8
def blocking(pid):
""" a non-deterministic "blocking" ? task
"""
@biggers
biggers / streamlogger.py
Last active Jun 30, 2017 — forked from pmuller/streamlogger.py
StreamLogger is a context handler which proxies an output stream to python's logging
View streamlogger.py
#!/usr/bin/env python3
#
# Port of "Fabric streamlogger" to Python3
# Credit (originally): https://gist.github.com/2376336.git
# pmuller - streamlogger.py
import sys
import logging
from io import StringIO
@biggers
biggers / network_mgr_wired_mgmt_recipe.sh
Created Jan 18, 2017
Enable wired-interfaces (incl VPN) to be managed by systemd - Ubuntu Linux 16+
View network_mgr_wired_mgmt_recipe.sh
# NetworkManager should manage wired interfaces!
# Linux Mint 18.x (Ubuntu 16.04)
# REF: "fixing VPN problem in Ubuntu",
# http://blog.wensheng.org/search?updated-min=2015-01-01T00:00:00-06:00&updated-max=2016-01-01T00:00:00-06:00&max-results=5
aptitude install etckeeper
git log
nmcli c # NOTE: no wired-interface controlled
emacs -nw /etc/NetworkManager/NetworkManager.conf
@biggers
biggers / x11vnc.sh
Created Aug 19, 2016
x11vnc service start-up script
View x11vnc.sh
#!/bin/sh
VNC_SERVER=/usr/bin/x11vnc
VNC_DISPLAY=:0
LOG_FILE=/tmp/x11vnc-run.log
case "$1" in
start|restart)
killall ${VNC_SERVER}
@biggers
biggers / ansible-tagged-install.sh
Last active Jan 18, 2017
Installing Ansible from 'git source' -- by tagged-release
View ansible-tagged-install.sh
## better, working "shell-recipe" for installing a tagged
## Ansible release, from Git source
## https://github.com/ansible/ansible/tags
sudo aptitude install python-yaml python-jinja2 python-paramiko
cd ~/git/Python
tag_name='v1.9.4-1'
git clone git://github.com/ansible/ansible.git --recursive
@biggers
biggers / Makefile.docker
Created Mar 22, 2016
GNU Makefile for docker-compose work
View Makefile.docker
## -*- makefile -*-
## biggers@utsl.com, Mark Biggers
## GNU Makefile for docker-compose build & run of a Python or other Project
##
## REFs:
## https://docs.docker.com/compose/reference/
## https://github.com/docker/compose/releases
##
@biggers
biggers / Dockerfile
Last active Mar 8, 2018
docker-compose build attempt for a Pyramid app
View Dockerfile
FROM phusion/baseimage:0.9.18
MAINTAINER biggers@utsl.com
ENV PYTHONUNBUFFERED 1
# ...put your own build instructions here...
RUN apt-get update --no-install-recommends && \
apt-get install -y --no-install-recommends \
You can’t perform that action at this time.