Skip to content

Instantly share code, notes, and snippets.

@tcg
tcg / README.md
Last active October 17, 2021 11:18
Foundation 6 Pagination HTML for WordPress Timber+Twig
@tcg
tcg / get_month_day_range.py
Created January 18, 2016 19:09
Get first and last day of a particular month, in Python, with no requirements outside of Python's standard library. From: https://gist.github.com/waynemoore/1109153#gistcomment-1193720
import datetime
import calendar
def get_month_day_range(date):
"""
For a date 'date' returns the start and end date for the month of 'date'.
Month with 31 days:
>>> date = datetime.date(2011, 7, 27)
>>> get_month_day_range(date)
@tcg
tcg / guessing_game.py
Created April 25, 2016 15:26
Some Python code to tinker with the ideas presented in the Numberphile episode "How to Win a Guessing Game".
"""
Some Python code to tinker with the ideas presented
in the Numberphile episode "How to Win a Guessing Game".
See: https://www.youtube.com/watch?v=ud_frfkt1t0
"""
import random
import time

Keybase proof

I hereby claim:

  • I am tcg on github.
  • I am tommygeorge (https://keybase.io/tommygeorge) on keybase.
  • I have a public key whose fingerprint is 4EB6 B9FC CF65 5C61 EBEA 8F22 5246 02EA E3D7 FF6B

To claim this, I am signing this object:

@tcg
tcg / iterm2-solarized.md
Created May 30, 2017 20:02 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@tcg
tcg / .zshrc
Created June 7, 2017 18:42
List Git branches by date; Helpful if you jump around a lot.
# List Git branches in order of most-recently-updated.
alias gitbranchesbydate="git for-each-ref --sort=-committerdate refs/heads/ --format='%(committerdate:iso8601) %09 %(refname) %09 %(authorname)' | sed -e 's-refs/heads/--'"
# Output looks like:
# 2014-06-06 12:58:53 -0500 tcg/donate_language_updates Tommy George
# 2014-06-06 10:28:04 -0500 integration Brad
# 2014-06-05 16:13:30 -0500 super_dev_branch Chris
@tcg
tcg / README.md
Created June 9, 2017 16:25
Raspberry Pi Zero W as Internet connected Access Point *and* Wireless Client

I wanted this capability for various reasons. It's not necessarily stable, because uap0 has to use the same channel as wlan0, and if you're traveling/mobile, wifi channels aren't necessarily predictable.

This is not a guide. This is just so I remember how to get back where I started, in case I wipe this thing. =)

Extremely helpful guides that got me here:

@tcg
tcg / how-i-configure-my-logitech-g502-mouse-to-make-me-more-productive.md
Created August 29, 2017 03:09
How I configure my Logitech G502 mouse to make me more productive

How I configure my Logitech G502 mouse to make me more productive

I use a "gaming mouse" as my current favorite every-day computer mouse, when I'm not just using the trackpad.

If you're not familiar with it, it's a great computer mouse that has some extra buttons that can be arbitrarily assigned key combos, macros, and various functions.

Recently, I decided to tweak some settings for every day desktop/work use, and I've been quite pleased. Here's a couple things I did:

Middle scroll wheel: left/right tilt

@tcg
tcg / gulpfile.js
Created February 14, 2018 05:09
Gulpfile example that builds Hugo site, scss/css, asset hashing, and html minification
/**
* This gulpfile inspired by http://danbahrami.io/articles/building-a-production-website-with-hugo-and-gulp-js/
*
* Tasks for building sass/scss, and hashed assets, in combination with the
* hugo generated blog.
*
*/
var gulp = require("gulp"),
sass = require("gulp-sass"),
@tcg
tcg / dates_for_year.py
Created July 27, 2018 20:15
Ended up not needing this. A Python Generator for getting a `datetime.date` for every day in a given year.
def _dates_for_year(year):
"""
A generator of all `datetime.date`s for a given integer year.
"""
if year != int(year):
raise ValueError(f"Year provided does not appear to be an integer. Provided: {year}")
for month in range(1, 12 + 1):
# Leaning on the calendar module to give the correct number of
# days for leap year February.