Skip to content

Instantly share code, notes, and snippets.

@fredrick
fredrick / rewalk.py
Created April 4, 2011 23:20
Example strategy to re-walk files that were not accounted for.
import os
import multiprocessing
class Event(object):
"""Mock event type"""
def __init__(self, **kwargs):
for key in kwargs:
setattr(self, key, kwargs[key])
@fredrick
fredrick / pyinotify.f4ce646a42b040eb08b0.log
Created April 11, 2011 08:51
Log file output to test pyinotify commit: f4ce646a42b040eb08b0
1302511080 : <Event dir=True mask=0x40000100 maskname=IN_CREATE|IN_ISDIR name=wordpress path=/gfs/www/stacks/fred.fred pathname=/gfs/www/stacks/fred.fred/wordpress wd=3 >
1302511147 : <Event dir=False mask=0x100 maskname=IN_CREATE name=wp-activate.php path=/gfs/www/stacks/fred.fred/wordpress pathname=/gfs/www/stacks/fred.fred/wordpress/wp-activate.php wd=4 >
1302511147 : <Event dir=False mask=0x100 maskname=IN_CREATE name=license.txt path=/gfs/www/stacks/fred.fred/wordpress pathname=/gfs/www/stacks/fred.fred/wordpress/license.txt wd=4 >
1302511147 : <Event dir=False mask=0x100 maskname=IN_CREATE name=wp-pass.php path=/gfs/www/stacks/fred.fred/wordpress pathname=/gfs/www/stacks/fred.fred/wordpress/wp-pass.php wd=4 >
1302511148 : <Event dir=False mask=0x100 maskname=IN_CREATE name=wp-login.php path=/gfs/www/stacks/fred.fred/wordpress pathname=/gfs/www/stacks/fred.fred/wordpress/wp-login.php wd=4 >
1302511148 : <Event dir=False mask=0x100 maskname=IN_CREATE name=readme.html path=/gfs/www/stacks/fred.fred/wordpre
@fredrick
fredrick / wc.js
Created May 17, 2011 22:26
Node.js Async I/O POC [equivalent of wc -l filename]
#!/usr/bin/env node
/**
* Node.js Async I/O POC [equivalent of wc -l filename]
* Run me: node wc.js [filename]
*/
var sys = require('sys'),
fs = require('fs');
@fredrick
fredrick / flot.benchmark.js
Created May 26, 2011 15:08
Load time series data via AJAX, graph it
$(document).ready(function() {
$.ajax({
type: 'GET',
url: 'query/',
data: ({
type: 'responses',
limit: 5000,
order: 'asc'
}),
dataType: 'json',
@fredrick
fredrick / README.txt
Created June 24, 2011 17:23
An annotated guide to basic HTML.
learn.html
An annotated guide to basic HTML.
Created by Fredrick Galoso (Updated 2011-06-24)
Public domain, but I'd love some credit. Remix, add, enjoy.
<!----> Are comments.
--- pyinotify.py.orig 2011-06-26 12:57:41.000000000 +0100
+++ pyinotify.py.new6 2011-06-26 17:17:56.000000000 +0100
@@ -69,6 +69,7 @@
import re
import asyncore
import glob
+import hashlib
try:
from functools import reduce
@fredrick
fredrick / ab-varnish-t1-micro.txt
Created June 27, 2011 20:41
Apache Bench: Varnish 2.1 + nginx 1.0 on t1.micro (x64)
$ ab -n 1000 -c 250 http://ec2-xx-xx-xx-xx.compute-1.amazonaws.com/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking ec2-xx-xx-xx-xx.compute-1.amazonaws.com (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
@fredrick
fredrick / ec2-manage-snapshots.rb
Created June 28, 2011 21:21 — forked from corck/AWS - EBS Snapshot Management
Simple script for creating snapshots of an EBS volume and keeping a certain number of those
#!/usr/local/bin/ruby
require 'AWS'
require 'yaml'
class SnapshotManagement
# initalize class, optional override path to yml file
# * options [String] :path ('')
#
def initialize(params = {})
@fredrick
fredrick / gist:1082811
Created July 14, 2011 16:31 — forked from tpitale/gist:162954
MongoDB init script
#! /bin/sh
### BEGIN INIT INFO
# Provides: mongodb
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the mongodb data-store
# Description: starts mongodb using start-stop-daemon
@fredrick
fredrick / gist:1085467
Created July 15, 2011 20:15
Seat-Python, Python 3.x.x compatibility issues
# See: http://bugs.python.org/issue10976
EEEEEEE
======================================================================
ERROR: test_database_exists (__main__.testSeat)
Database exists
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/local/lib/python3.1/dist-packages/seat.py", line 86, in __send
result = json.loads(request.read())
File "/usr/lib/python3.1/json/__init__.py", line 291, in loads