Skip to content

Instantly share code, notes, and snippets.

Drew Fradette drewfradette

Block or report user

Report or block drewfradette

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
View git-root.sh
#!/bin/bash
set -e
git rev-parse --show-toplevel
View pedantically_commented_playbook.yml
---
# ^^^ YAML documents must begin with the document separator "---"
#
#### Example docblock, I like to put a descriptive comment at the top of my
#### playbooks.
#
# Overview: Playbook to bootstrap a new host for configuration management.
# Applies to: production
# Description:
# Ensures that a host is configured for management with Ansible.
View webtail.py
#!/usr/bin/python
# Equivalent of "tail -f" as a webpage using websocket
# Usage: webtail.py PORT FILENAME
# Tested with tornado 2.1
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/
import tornado.httpserver
@drewfradette
drewfradette / headtail.py
Created Feb 13, 2013
Python - recreate head/tail functionality
View headtail.py
import os
def head(filename, count=1):
"""
This one is fairly trivial to implement but it is here for completeness.
"""
with open(filename, 'r') as f:
lines = [f.readline() for line in xrange(1, count+1)]
return filter(len, lines)
@drewfradette
drewfradette / gist:2661851
Created May 11, 2012
notify - Gnome Notification Script
View gist:2661851
#!/usr/bin/python
# Filename notify
# Description Show a notification in Gnome3
# Author Drew Fradette <http://www.github.com/drewfradette>
# Last Updated 2012-04-18
# Usage notify -t "Eat cheese" -m "It tastes delicious"
#######################################################
import pynotify
import sys
View gist:2645538
#!/bin/bash
# Filename benchmark
# Description execute a program periodically,showing fullscreen, colored output
# Author Drew Fradette <http://www.github.com/drewfradette>
# Last Updated 2012-05-08
# Usage benchmark example.com
# bash_version 4.2.10(1)-release
#######################################################
help() {
printf "Usage: ${0} example.com"
@drewfradette
drewfradette / gist:2618197
Created May 6, 2012
watchc - Watch with colour
View gist:2618197
#!/bin/bash
# Filename watchc
# Description execute a program periodically,showing fullscreen, colored output
# Author Drew Fradette <http://www.github.com/drewfradette>
# Version 0.5
# Last Updated 2012-01-31
# Usage watchc -n 5 ls -lah /tmp
# bash_version 4.2.10(1)-release
#######################################################
usage() {
@drewfradette
drewfradette / gist:2617991
Created May 6, 2012
CodeCat - syntax highlighting for cat
View gist:2617991
#!/bin/bash
# Filename catc
# Description print files to stdout with syntax highlighting (using python-pygments)
# Author Drew Fradette <http://www.github.com/drewfradette>
# Version 0.6
# Last Updated 2012-09-26
# Usage catc file.sh
# bash_version 4.2.10(1)-release
#######################################################
You can’t perform that action at this time.