Skip to content

Instantly share code, notes, and snippets.

View anildigital's full-sized avatar
:octocat:

Anil Wadghule anildigital

:octocat:
View GitHub Profile
Gist concept is nice! http://twitter.com/anildigital/statuses/864375699
svn status | grep "^\\?" | sed -e 's/? *//' | sed -e 's/ /\\\\ /g' | xargs rm
find %s | egrep \"rb$\" | xargs ctags-exuberant -a -e -f %s/TAGS --exclude=vendor --exclude=public --exclude=log --exclude=db
class MyThread
def initialize(thread_name)
thread1(thread_name)
end
def thread1(thread_name)
Thread.new do
for i in (1..10)
puts "in #{thread_name} Thread"
sleep(1)
#!/usr/bin/env ruby
#
# Author: Anil Wadghule
#
# FRenamer: Renames image files for passed command line parameters
# Usage: frenamer . "the_dark_knight"
# It renames image files in current directory with names like the_dark_knight_1.jpg, the_dark_knight_2.jpg ...
#
# Installation:
# Copy it to your /usr/bin or any directory which is in your PATH
/LOG OPEN -targets #railsconf ~/irclogs/railsconf/railsconf_%Y-%m-%d
/LOG OPEN -targets #fana ~/irclogs/fanalog-%Y-%m-%d [encrypted]
# Profiler starts
require 'ruby-prof'
RubyProf.start
@return_data = your_method(@your_data)
result = RubyProf.stop
printer = RubyProf::GraphHtmlPrinter.new(result)
path = File.join(RAILS_ROOT, 'public', 'profiling_output.html')
upstream planetrubyonrails.net {
server 127.0.0.1:8014;
server 127.0.0.1:8015;
}
server {
listen 80;
server_name planetrubyonrails.net;
#rewrite ^/(.*) http://planetrubyonrails.net permanent;
# Useful s3 commands
s3sync -r docs anilwadghule:
CmdUtils.CreateCommand({
name: "page-width",
author: { name: "Jacky See"},
license: "GPL",
description: "Limit the page width by a given parameter, align it to center",
help: "e.g. page-width 400",
takes: {"input": noun_arb_text},
preview: function( pblock, input ) {
var template = "Setting page to width ${w} (default is 500)";
var width = 500; //default width