Skip to content

Instantly share code, notes, and snippets.

; gentrifire.com [15259]
$TTL 86400
@ IN SOA ns1.linode.com. root.gentrifire.com. (
2010082364
14400
14400
1209600
86400
)
@ NS ns1.linode.com.
var http = require('http');
var server = http.createServer(function (req, res) {
res.writeHead(200, { "Content-Type": "text/plain" })
res.end("Hello world\n");
});
server.listen(parseInt(process.env.PORT || 8080));
@visnup
visnup / ruby-sass.js
Created October 3, 2010 19:30
I know: it's blasphemy. whatever.
// if you have the ruby sass gem installed, use the `sass` executable from it to
// generate css instead of the incomplete sass.js implementation.
express.compiler.compilers.sass.compile = function(str, fn) {
try {
var sass = require('child_process').spawn('sass', ['--stdin']),
append = function(data) { css += data; },
css = '';
sass.stdout.on('data', append);
sass.stderr.on('data', append);
@visnup
visnup / gist:663696
Created November 5, 2010 05:40
iPhoto 9.1 codesign fails
Last login: Thu Nov 4 22:30:18 on console
[visnup@qi ― 10:30 PM ――――――――――――――――――――――――――――――――――――――――――――――――――――――― ~]
$ codesign -vv /Applications/iPhoto.app/
/Applications/iPhoto.app/: a sealed resource is missing or invalid
/Applications/iPhoto.app/Contents/Resources/English.lproj/FSCalendarsMissingView.nib/keyedobjects.nib: resource added
/Applications/iPhoto.app/Contents/Resources/GSNoCalendar.png: resource added
@visnup
visnup / mongo lightning.md
Created November 9, 2010 00:23
mongodb lightning talk

MONITAUR IS

instant, real-time server monitoring. written during rails rumble 2010. [show website] [<1 minute walkthrough]

MONITAUR USES

@visnup
visnup / README.js
Created November 15, 2010 21:36 — forked from igrigorik/webapp.rb
node.js version inspired by igrigorik's any ruby object, as a webapp! 'cause we can too.
#!/usr/bin/env node
var http = require('http')
, webapp = require('webapp');
http.createServer(webapp.bind([])).listen(8000);
// ^^^^^^^^^^^^^^^
// | (x)
// ROFLSCALE DEQUE ---/
@visnup
visnup / objects as webapps.txt
Created November 15, 2010 21:48
the obligatory benchmarks too
$ ab -c 10 -n 500 http://127.0.0.1:8000/push/1
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 127.0.0.1 (be patient)
Completed 100 requests
Completed 200 requests
Completed 300 requests
Completed 400 requests
@visnup
visnup / gist:733671
Created December 8, 2010 18:24
/etc/newsyslog.d/local.conf
We couldn’t find that file to show.
@visnup
visnup / tiff.rb
Created January 3, 2011 07:50
recover jpg version of image out of corrupt/weird raw/dng tiff
#!/usr/bin/env ruby
require 'rubygems'
require 'ruby-debug'
def out s = ''
puts "#{$indent}#{s}"
end
def read_ifd f, order = 'n', indent = ''
# breakpoint set inside the integration specs.
# a simple person.posts(true) causes a whole lotta activity still.
(rdb:1) person.posts(true)
mongoid_test['posts'].find({"person_id"=>BSON::ObjectId('4d2dfe965b692c635a000001')}, {})
mongoid_test['posts'].find({:_id=>BSON::ObjectId('4d2dfe965b692c635a000002'), :version=>6}, {}).limit(-1)
mongoid_test['posts'].find({:_id=>BSON::ObjectId('4d2dfea15b692c635a000004'), :version=>1}, {}).limit(-1)
MONGODB mongoid_test['posts'].update({"_id"=>BSON::ObjectId('4d2dfe965b692c635a000002'), "versions._id"=>BSON::ObjectId('4d2dfea15b692c635a000004')}, {"$set"=>{"versions.0.updated_at"=>Wed Jan 12 19:35:16 UTC 2011}})
mongoid_test['posts'].find({:_id=>BSON::ObjectId('4d2dfeaa5b692c635a000006'), :version=>2}, {}).limit(-1)
MONGODB mongoid_test['posts'].update({"_id"=>BSON::ObjectId('4d2dfe965b692c635a000002'), "versions._id"=>BSON::ObjectId('4d2dfeaa5b692c635a000006')}, {"$set"=>{"versions.1.updated_at"=>Wed Jan 12 19:35:16 UTC 2011}})