Skip to content

Instantly share code, notes, and snippets.

View lmacken's full-sized avatar

Luke Macken lmacken

  • Colorado
View GitHub Profile
@lmacken
lmacken / linkify.py
Created February 21, 2012 19:04
linkify.py - Turns URLs into links
#!/usr/bin/env python
# linkify.py - Turns URLs into links.
#
# Using on a file:
#
# $ linkify.py <filename>
# <a href="http://lewk.org">http://lewk.org</a>
#
# Using within a pipeline:
#
@lmacken
lmacken / rawhide-pkg-licenses.py
Created March 24, 2012 21:00
Generate a list of all Fedora packages and their license
#!/usr/bin/env python
# Writes a file called 'rawhide-pkg-licenses.txt' containing a list of all
# packages in Fedora with their corresponding license.
#
# Before running, you must first warm up the yum cache:
#
# sudo yum --disablerepo=\* --enablerepo=rawhide-source makecache
#
# Author: Luke Macken <lmacken@redhat.com>
@lmacken
lmacken / veracart-exporter.py
Created April 3, 2012 20:27
VeraCart Product Catalog Exporter
# VeraCart Product Catalog Exporter
# Luke Macken <lewk@csh.rit.edu>
# License: GPLv3+
import os
import csv
import uuid
from urllib import urlretrieve
from urllib2 import urlopen
@lmacken
lmacken / pyblosxom-to-blogofile.py
Created April 5, 2012 00:05
Ports a pyblosxom 'entries' directory into blogofile markdown files
# Ports a pyblosxom 'entries' directory into blogofile markdown files
# Luke Macken <lmacken@redhat.com>
import os, stat, time
for old in os.listdir('entries'):
if old.startswith('comments') or old == 'LATEST':
continue
new = file('_posts/%s.html' % old.replace('.txt', ''), 'w')
@lmacken
lmacken / sshtail.py
Last active October 3, 2015 07:08
A script to tail a file across many systems at once
# sshtail.py
# A script to tail a file across many systems at once
# Author: Luke Macken <lmacken@redhat.com>
# License: GPLv3+
import getpass
import subprocess
servers = ['app1', 'app2', 'app3', 'app4', 'app5', 'app6', 'app7']
logfile = '/var/log/httpd/access_log'
@lmacken
lmacken / tempofinder.py
Created May 25, 2012 19:46
Add tempo metadata to your music collection. This script has been rewritten and turned into a new project: http://github.com/lmacken/tempi
# NOTE: I re-wrote this code and turned it into a real project:
# http://github.com/lmacken/tempi
# tempofinder - Add tempo metadata to your music
# ==============================================
# Sign up for an EchoNest API key: https://developer.echonest.com/docs
# sudo yum -y install python-virtualenv python-eyed3
# virtualenv env
# source env/bin/activate
# pip install pyechonest
@lmacken
lmacken / gist:5013514
Last active December 14, 2015 02:28
bzgrep apache logs for stuff and xz compress them over ssh to another box
bzgrep 'stuff' /var/log/hosts/app0[1-8]*/*/*/*/http/access_log.bz2 \
| cut -d':' -f2- \
| xz --compress --stdout -3 \
| ssh -c blowfish another_box \
"cat - > ~/log.xz"
@lmacken
lmacken / fedmsg-sessions.py
Last active December 17, 2015 08:09
Count the number of current and maximum fedmsg zeromq connections
# A script to count the number of current and maximum fedmsg zeromq connections
# Author: Luke Macken <lmacken@redhat.com>
# License: GPLv3
import requests
from multiprocessing.pool import ThreadPool
from BeautifulSoup import BeautifulSoup
num_proxies = 8
@lmacken
lmacken / countdown.py
Last active March 29, 2022 11:45
A fullscreen countdown timer
#!/usr/bin/env python
# ----------------------------------------------------------------------------
# A fork of pyglet's timer.py by Luke Macken
#
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
@lmacken
lmacken / check_updateinfo.py
Last active December 23, 2015 18:29
Download the updateinfo.xml from Fedora updates-testing and stable repos and check it for notices with duplicate update IDs.
# Download the updateinfo.xml from fedora stable & testing repos and check it
# for notices with duplicate update IDs.
import os
import urllib
from yum.update_md import UpdateMetadata
ver = 20
testing_url = 'http://dl.fedoraproject.org/pub/fedora/linux/updates/testing/%d/x86_64/repodata/updateinfo.xml.gz' % ver