Skip to content

Instantly share code, notes, and snippets.

View guyrt's full-sized avatar

Tommy Guy guyrt

View GitHub Profile
@guyrt
guyrt / active_branches.sh
Created April 3, 2025 17:47
Quick script to find active branches in a repo. Mostly a Gemini2.5 test
#!/bin/bash
# --- Configuration ---
REPO_PATH="."
# Calculate the timestamp for 7 days ago from the current time
# Using the context's current time: Thursday, April 3, 2025 at 10:30:56 AM PDT
# If running this later, 'date -d "7 days ago" +%s' will use the actual current time.
# For consistency with the request context:
# CURRENT_DATE_STR="2025-04-03 10:30:56 PDT"
# ONE_WEEK_AGO_TIMESTAMP=$(date -d "$CURRENT_DATE_STR - 7 days" +%s)
@guyrt
guyrt / py
Created January 26, 2022 16:45
Copy a PDF without any extra data.
# Simple python script that will copy content from 1 pdf to a new pdf.
# FYI I just copied from https://github.com/pmaupin/pdfrw/blob/master/examples/cat.py while I was playing around.
import sys
import os
from pdfrw import PdfReader, PdfWriter
reader = PdfReader(sys.argv[1])
pages = reader.pages
@guyrt
guyrt / gist:5268176
Created March 29, 2013 01:37
Installer for sqoop on Amazon's EMR
#!/bin/bash
# Install sqoop and mysql connector. Store in s3 and load
# as bootstrap step.
bucket_location='<put your bucket here>'
sqoop_jar='sqoop-1.4.3.bin__hadoop-1.0.0'
sqoop_jar_gz=$sqoop_jar.tar.gz
mysql_dir='mysql-connector-java-5.1.24'
mysql_jar='mysql-connector-java-5.1.24-bin.jar'
mysql_dir_gz=$mysql_dir.tar.gz
@guyrt
guyrt / gist:5076942
Created March 3, 2013 16:57
Match url patterns as regular expressions with named groups.
import re
class NoURLMatchException(Exception):
pass
class URLParser(object):
def __init__(self, regex_definition_handle):
@guyrt
guyrt / gist:5074374
Created March 3, 2013 03:34
Get all named url patterns in django
from django.core import urlresolvers
resolver = urlresolvers.get_resolver(None)
url_re_list = ['^/' + url[1] for url in resolver.reverse_dict.itervalues()]