Skip to content

Instantly share code, notes, and snippets.

@shapiromatron
shapiromatron / README.md
Created February 19, 2020 16:49
simple-logging

Simple python logging

This gist demonstrates how to setup logging and write to both standard-error and a file.

Output is printed to stderr as well as a file. For example:

$ python logger.py 
2020-02-19 11:46:59,473: WARNING: __main__: Starting to do stuff...
2020-02-19 11:47:01,480: INFO: __main__: Stuff done!
@shapiromatron
shapiromatron / README.md
Last active August 20, 2020 04:10
centos7 + httpd + python3.6 + flask

Running a python3 app on centos7 w/ apache

Similar to how things are done in nginx-land, we'll run a separate process for serving a flask application (or any other wsgi python app), and then we'll configure apache to serve it by a reverse proxy.

Let's get started:

# install the things
sudo yum install httpd python3 vim
@shapiromatron
shapiromatron / IE11.html
Last active October 5, 2020 16:13
IE11 warning
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta charset="UTF-8" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/2.2.2/css/bootstrap-responsive.min.css" />
</head>
<body>
<div id="container">
@shapiromatron
shapiromatron / Dockerfile
Last active July 22, 2021 16:50
adding HTTP Basic Authentication to an nginx container
FROM nginx:1.20-alpine
RUN apk --update --no-cache add apache2-utils
COPY nginx.conf /etc/nginx/nginx.conf
COPY index.html /public/data/index.html
COPY htpasswd /etc/nginx/conf/htpasswd