Skip to content

Instantly share code, notes, and snippets.

View map.js
var data = [[1294816638788, 560], [1294816703445, 850]];
var dates = data.map(function(data){
return data[0];
});
var values = data.map(function(data){
return data[1];
});
console.log(dates);
console.log(values);
@fredrick
fredrick / axe.js
Created Jul 21, 2011
Axe JavaScript
View axe.js
/**
* Inspired by http://d24w6bsrhbeh9d.cloudfront.net/photo/172219_460s.jpg
*/
function Understand() {
this.this = 'loser';
}
function A() {
this.girlfriend = true;
@fredrick
fredrick / gist:1085467
Created Jul 15, 2011
Seat-Python, Python 3.x.x compatibility issues
View gist:1085467
# 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
@fredrick
fredrick / gist:1082811
Created Jul 14, 2011 — forked from tpitale/gist:162954
MongoDB init script
View gist:1082811
#! /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 / ec2-manage-snapshots.rb
Created Jun 28, 2011 — forked from corck/AWS - EBS Snapshot Management
Simple script for creating snapshots of an EBS volume and keeping a certain number of those
View ec2-manage-snapshots.rb
#!/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 / ab-varnish-t1-micro.txt
Created Jun 27, 2011
Apache Bench: Varnish 2.1 + nginx 1.0 on t1.micro (x64)
View ab-varnish-t1-micro.txt
$ 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
View pyinotify.get_wd.patch
--- 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 / README.txt
Created Jun 24, 2011
An annotated guide to basic HTML.
View README.txt
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.
@fredrick
fredrick / flot.benchmark.js
Created May 26, 2011
Load time series data via AJAX, graph it
View flot.benchmark.js
$(document).ready(function() {
$.ajax({
type: 'GET',
url: 'query/',
data: ({
type: 'responses',
limit: 5000,
order: 'asc'
}),
dataType: 'json',
@fredrick
fredrick / wc.js
Created May 17, 2011
Node.js Async I/O POC [equivalent of wc -l filename]
View wc.js
#!/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');
You can’t perform that action at this time.