Skip to content

Instantly share code, notes, and snippets.

View biggers's full-sized avatar

Mark Biggers biggers

View GitHub Profile
@biggers
biggers / recipe-pyenv.sh
Created September 26, 2017 17:46
shell-recipe for pyenv install of Python 3.6.2 on CentOS / Redhat 6.7
# REF: https://github.com/pyenv/pyenv/blob/master/README.md
# ... building Python 3.6.2 on Bastion, "locally"
# yum install [Python3 build pre-reqs, on CentOS 6.7]
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
tee -a $HOME/.bash_profile <<EOF
export PATH="\$HOME/.pyenv/bin:\$PATH"
eval "\$(pyenv init -)"
@biggers
biggers / py_syslog_dict_config.py
Last active May 31, 2023 20:21
Python dictConfig logging example using SyslogHandler - modified from Stackoverflow answer
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'
@mariocj89
mariocj89 / python-logging.md
Last active April 13, 2024 13:15
Understanding logging in Python

Logging trees

Introduction

When applications are running in production, they become black boxes that need to be traced and monitored. One of the simplest, yet main, ways to do so is logging. Logging allows us - at the time we develop our software - to instruct the program to emit information while the system is running that will be useful for us and our sysadmins.

@Integralist
Integralist / 1. README.md
Last active March 24, 2022 01:01
[Python Tornado Example Application] #python #python3 #tornado #example #basic #simple

There are two examples...

  1. Simple
  2. Advanced
@cessor
cessor / serve.py
Last active June 4, 2018 19:52
Simple Tornado App Skeleton
import logging
import os
import uuid
from tornado import gen
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.options import define, options
from tornado.web import Application, StaticFileHandler, url
@biggers
biggers / network_mgr_wired_mgmt_recipe.sh
Created January 18, 2017 14:09
Enable wired-interfaces (incl VPN) to be managed by systemd - Ubuntu Linux 16+
# 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
@dgarnier
dgarnier / nfs_add_automount.sh
Last active April 12, 2017 19:56
Get a Debian Jessie Beaglebone to mount an NFS share...
#!/bin/bash
usage="$(basename "$0") [-h] mountpoint nfs_server:directory"
while getopts ":h" opt; do
case $opt in
h)
echo $usage >&2
exit 1
;;
@fabianvf
fabianvf / oreilly_downloader.py
Last active February 26, 2020 13:42
Downloads Oreilly free ebooks by category. Requires requests library and python 2. Categories I've see so far are business, data, iot, security, web-platform, webops-perf, programming, so usage would look like: python oreilly_downloader.py business data iot security web-platform webops-perf programming
import os
import re
import sys
import requests
filename_matcher = re.compile(r'http://www.oreilly.com/(.*)/free/(.*).csp')
def main():
categories = sys.argv[1:]
urls = map(lambda x: 'http://www.oreilly.com/{}/free/'.format(x), categories)
@biggers
biggers / x11vnc.sh
Created August 19, 2016 14:37
x11vnc service start-up script
#!/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 January 18, 2017 14:10
Installing Ansible from 'git source' -- by tagged-release
## 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