Skip to content

Instantly share code, notes, and snippets.

Greg Meece GLMeece

Block or report user

Report or block GLMeece

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
@GLMeece
GLMeece / Steps_to_Terminal_Enlightenment_on_a_Mac.md
Last active Oct 24, 2019
Steps to Terminal Enlightenment on a Mac (tweaking your terminal for fun and profit)
View Steps_to_Terminal_Enlightenment_on_a_Mac.md
@GLMeece
GLMeece / .zshrc
Created Sep 5, 2019
Z-shell Resource File PowerLevel9K Example
View .zshrc
# 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 / export_ini_values.sh
Last active Mar 19, 2019
Exporting INI file values as Environmental Variables
View export_ini_values.sh
# 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
View nice_title_case_func.py
def nice_title_case(str_in):
"""Converts a string to Title Case, with conventional exceptions which
need not be capitalized if they are not the first word in the title.
"""
exceptions_to_title_casing = (
"a", "an", "and", "at",
"but", "by", "for", "in",
"nor", "of", "on", "or",
"so", "the", "to", "up", "yet"
)
@GLMeece
GLMeece / http_bad_codes_dict.py
Created Mar 15, 2019
HTTP Bad Return Codes (as Python Dictionary)
View http_bad_codes_dict.py
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",
@GLMeece
GLMeece / pandoc_markdown_to_word.md
Last active Oct 2, 2018
Using PanDoc to Convert Word to Markdown
View pandoc_markdown_to_word.md
pandoc -f docx -t markdown -o my_example_output.md my_example_input.docx
@GLMeece
GLMeece / Python_Virtual_Environments.md
Last active Jul 14, 2019
Setting up a Virtual Environment for Python using VirtualEnvWrapper
View Python_Virtual_Environments.md

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 / Sphinx_Setup_for_autodoc.md
Last active Apr 4, 2019
Setting up Sphinx for generating documentation from DocStrings, leveraging the Napoleon extension.
View Sphinx_Setup_for_autodoc.md

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:

View reStructuredText_testing.rst

Testing reST Code Blocks

Code Block (Python):

jnk_instance = "http://jenkins.jarvis.cylancecorp.com:8080/"
jnk_user = 'myusername'
jnk_pass = 'mypassword'
my_test_run = JenkinsJobTestRunRetrieval(jnk_instance, jnk_user, jnk_pass)
@GLMeece
GLMeece / meta-tags.md
Created Oct 21, 2017 — forked from kevinSuttle/meta-tags.md
List of Usable HTML Meta and Link Tags
View meta-tags.md

Copied from http://code.lancepollard.com/complete-list-of-html-meta-tags/

Basic HTML Meta Tags

<meta charset='UTF-8'>
<meta name='keywords' content='your, tags'>
<meta name='description' content='150 words'>
<meta name='subject' content='your website's subject'>
<meta name='copyright' content='company name'>
You can’t perform that action at this time.