Skip to content

Instantly share code, notes, and snippets.

View GLMeece's full-sized avatar

Greg Meece GLMeece

View GitHub Profile
@GLMeece
GLMeece / Sphinx_Setup_for_autodoc.md
Last active January 31, 2025 03:04
Setting up Sphinx for generating documentation from DocStrings, leveraging the Napoleon extension.

Sphinx Setup for autodoc

Sphinx is a documentation generator that is the de facto standard for Python projects. The official documentation can be a bit daunting as it includes so many options, it's hard to know where to start.

Note: This Gist was updated on 04/04/2019 to accomodate a newer version of Sphinx, as well as Python 3.7. YMMV!

This document is written with the following presuppositions:

@GLMeece
GLMeece / Python_Virtual_Environments.md
Last active November 25, 2019 10:25
Setting up a Virtual Environment for Python using VirtualEnvWrapper

Virtual Environments

  1. Before beginning, you should have a version of pip installed. If you don't, it is recommended you install it universally via the Terminal: sudo easy_install pip
  2. Once you do, install virtualenvwrapper: sudo pip install virtualenvwrapper. More information can be found in Read the Docs
  3. Change into the directory where your new project is; e.g., cd ~/Documents/Repos/my_new_project
  4. Create your new environment in this directory, automatically giving it the name of the current directory: thisdir=${PWD##*/};mkvirtualenv -a . -r requirements.txt $thisdir

Using Your Virtual Environment

  • To make sure you remember what your virtual environment is named (and, indeed - all you have created), execute lsvirtualenv which lists all virtual environments.
@GLMeece
GLMeece / pandoc_markdown_to_word.md
Last active October 2, 2018 18:10
Using PanDoc to Convert Word to Markdown
pandoc -f docx -t markdown -o my_example_output.md my_example_input.docx
@GLMeece
GLMeece / http_bad_codes_dict.py
Created March 15, 2019 15:46
HTTP Bad Return Codes (as Python Dictionary)
http_bad_codes = {
"400": "Bad Request",
"401": "Unauthorized",
"402": "Payment Required",
"403": "Forbidden",
"404": "Not Found",
"405": "Method Not Allowed",
"406": "Not Acceptable",
"407": "Proxy Authentication Required",
"408": "Request Timeout",
"""Nice Title Case Function plus quick demo"""
def nice_title_case(str_in: str) -> str:
"""Converts a string to Title Case, with conventional exceptions which
need not be capitalized if they are not the first word in the title.
Reference: https://en.wikipedia.org/wiki/Title_case
*Note*: Prepositional rules are not strictly enforced
@GLMeece
GLMeece / export_ini_values.sh
Last active November 17, 2022 20:49
Exporting INI file values as Environmental Variables
# It is assumed that $HOME is already defined and exported...
# Assuming within our home directory,
# we have a hidden directory called '.env'
envvarsdir="/.env/"
# ...and within that directory we had a file named 'secret_vars.ini'...
envvarsfile=secret_vars.ini
# ...we'd build the path
envvarspath=$HOME$envvarsdir$envvarsfile
@GLMeece
GLMeece / .zshrc
Created September 5, 2019 22:07
Z-shell Resource File PowerLevel9K Example
# zmodload zsh/zprof # <-- enable for shell profiling
# Note: for more options info, see:
# https://gist.github.com/geeknam/4423298046c4383d36a91c404ff049b1
# Autoload info:
# With the -U flag, alias expansion is suppressed when the function is loaded.
# -z mark the function to be autoloaded using the zsh style
autoload -Uz compinit
@GLMeece
GLMeece / Steps_to_Terminal_Enlightenment_on_a_Mac.md
Last active March 6, 2025 10:16
Steps to Terminal Enlightenment on a Mac (tweaking your terminal for fun and profit)
@GLMeece
GLMeece / docker_cheatsheet.md
Last active February 8, 2021 17:45
Docker Cheat Sheet

Useful Docker Cheat Sheet

Random Tips

  • FROM — specifies the base (parent) image; typically you specify both the image name as well as the label. 🍰
  • RUN — runs a command and creates an image layer. Used to install packages into containers. 🍰
@GLMeece
GLMeece / casing_styles.md
Last active November 8, 2021 22:24
Variable/Constant Casing Styles

Computer Language Case Styles

A quick discussion of the most popular ways to invoke variable (or constant) names using case and/or space replacement.

These styles are:

  • camelCase
  • PascalCase
  • snake_case
  • kebab-case