Skip to content

Instantly share code, notes, and snippets.

View thegoleffect's full-sized avatar

Van Nguyen thegoleffect

View GitHub Profile
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
#!/usr/bin/env python
"""
A script to query the Amazon Web Services usage reports programmatically.
Ideally this wouldn't exist, and Amazon would provide an API we can use
instead, but hey - that's life.
Basically takes your AWS account username and password, logs into the
website as you, and grabs the data out. Always gets the 'All Usage Types'
#!/usr/bin/env node
var sys = require("sys"),
fs = require("fs");
var indented = "";
(function (json) {
indented = /(^[\t ]*)/.exec(json)[0] || "";
try {
#!/usr/bin/python
import sys
code = """#!/usr/bin/python
import sys
code = {0}{1}{0}
def initial_solution():
@thegoleffect
thegoleffect / rvm-version.rb
Created April 20, 2011 19:40 — forked from thbar/rvm-version.rb
install rvm specific version
curl -s https://rvm.beginrescueend.com/install/rvm -o rvm-installer
chmod +x rvm-installer
./rvm-installer 1.6.3
@thegoleffect
thegoleffect / index.html
Created August 31, 2011 20:39
dnode auth working example
<html>
<head>
<script src="/dnode.js" type="text/javascript"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
DNode({
session : function (session) {
$('#auth :visible').slideUp();
$('#user').text(session.user);
@thegoleffect
thegoleffect / redis.markdown
Created September 3, 2011 00:33 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@thegoleffect
thegoleffect / snippet.js
Created January 13, 2012 11:05 — forked from christopherdebeer/snippet.js
Node.js Express - Mobile detection
app.get('/', function(req, res){
var ua = req.header('user-agent');
if(/mobile/i.test(ua)) {
res.render('mobile.html');
} else {
res.render('desktop.html');
}
});
@thegoleffect
thegoleffect / minimal-logger.coffee
Created January 18, 2012 13:56 — forked from technoweenie/minimal-logger.coffee
Minimal node.js logger
# logger = require('logger').create()
# logger.info("blah")
# => [2011-3-3T20:24:4.810 info (5021)] blah
# logger.debug("boom")
# =>
# logger.level = Logger.levels.debug
# logger.debug(function() { return "booom" })
# => [2011-3-3T20:24:4.810 error (5021)] booom
class Logger
constructor: (options) ->
@thegoleffect
thegoleffect / clark.coffee
Created April 11, 2012 21:19 — forked from friggeri/clark.coffee
Sparklines in CoffeeScript
#!/usr/bin/env coffee
ticks = ['▁','▂','▃','▄','▅','▆','▇','█']
exports.clark = (data) ->
m = Math.min data...
n = (Math.max(data...)-m)/(ticks.length - 1)
(ticks[(t-m)/n >> 0] for t in data).join('')
if require.main == module
data = process.argv