Skip to content

Instantly share code, notes, and snippets.

Madhusudhan Srinivasa madhums

Block or report user

Report or block madhums

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
madhums / environment.rb
Created Mar 28, 2011
Upload images to paperclip with remote uri's
View environment.rb
require 'open-uri'
madhums / browseimage.html.erb
Created Mar 28, 2011
Using flickr image search api in rubyonrails
View browseimage.html.erb
<form id="imagesearch" action="/modelname/imagesearch" method="post" >
Search for an image
<input type="text" name="query" class="floatleft" />
<input type="submit" name="submit" value="submit"/>
<div id="imageresults"></div>
madhums / searchd
Created Apr 1, 2011
running searchd manually
View searchd
searchd --pidfile --config config/development.sphinx.conf
madhums / mongod
Created Jul 19, 2011
mongod init script. Placed in /etc/init.d/mongod
View mongod
#! /bin/sh
# Provides: mongodb
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Mongodb startup script
# Description: Mongodb start stop daemon sends SIGINT to terminate
# say man signal to see details
# Please check the startup params and replication options
madhums / app.js
Created Aug 3, 2011
Express settings for node.js
View app.js
var express = require('express');
var app = express.createServer();
base: function(){
// return the app's mount-point
// so that urls can adjust. For example
// if you run this example /post/add works
madhums / mapreduce.js
Created Aug 3, 2011
mapreduce using mongodb and mongoose
View mapreduce.js
var mongoose = require('mongoose');
// map function
var map = function(){
emit(this.field_to_group_by, {
other_fields: this.other_fields
// list other fields like above to select them
madhums / Capfile
Created Aug 3, 2011
node.js multistage deployment using capistrano.
View Capfile
# /Capfile
# you need to install capistrano gem
# gem install capistrano
# gem install capistrano-ext
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
load 'config/deploy'
madhums / EOFERROR
Created Aug 6, 2011
multipart form data EOFERROR rails
Started POST "/" for at 2011-08-06 06:21:02 -0700
2011-08-06T13:21:02+00:00 app[web.1]:
2011-08-06T13:21:02+00:00 app[web.1]: EOFError (bad content body):
2011-08-06T13:21:02+00:00 app[web.1]:
2011-08-06T13:21:02+00:00 app[web.1]:
2011-08-06T13:21:02+00:00 app[web.1]:
2011-08-06T13:21:02+00:00 app[web.1]: Rendered .bundle/gems/ruby/1.9.1/gems/actionpack-3.0.0/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (22.9ms)
2011-08-06T13:21:02+00:00 app[web.1]: Error during failsafe response: ActionView::Template::Error
2011-08-06T13:21:02+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.3/lib/rack/utils.rb:495:in `parse_multipart'
2011-08-06T13:21:02+00:00 app[web.1]: /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.3/lib/rack/request.rb:270:in `parse_multipart'
madhums / post_data.rb
Created Aug 8, 2011
rest client to post data
View post_data.rb
# git clone
require "rubygems"
require './rest-client/lib/rest_client' 'http://localhost:9292/', :foo =>"public/images/rails.png"), :multipart => true
# '', :foo =>"public/images/rails.png"), :multipart => true
# '', :foo =>"public/images/rails.png"), :multipart => true
# '', :foo =>"public/images/rails.png"), :multipart => true
madhums / imagemagick.err
Created Aug 11, 2011
imagemagick jpeg lib missing
View imagemagick.err
if you get this error
[paperclip] An error was received while processing: #<Paperclip::NotIdentifiedByImageMagickError /tmp/stream20110811-30041-x7rvaq-0.jpg is not recognized by the 'identify' command.
$identify whatever_file_name.jpg
if you get something like this
identify: no decode delegate for this image format `madhusudhanms.jpg' @ error/constitute.c/ReadImage/532.
You can’t perform that action at this time.