Skip to content

Instantly share code, notes, and snippets.

@sriranggd
sriranggd / kannada_wordalla_helper.rb
Last active January 23, 2022 06:14
ವರ್ಡಲ್ಲಾ ಸಹಾಯಕ
# encoding: utf-8
#
# The Kannada dictionary file needed for this script is available here : https://github.com/alar-dict/data
# Download the YAML file and place it in the same directory as this script.
#
# Using this script :
# This script is useful in an IRB console to be used interactively.
#
# 1. Lanuch irb
# 2. Load this script with require 'wordalla.rb'
@sriranggd
sriranggd / mongoid_aliased_field.rb
Created January 20, 2012 21:02
Patch to fix Mongoid aliased names shortcomings
# Copy the contents to a file named mongoid_aliased_field.rb and drop it in the lib/ directory of your Rails app
# Add lib/ to autoload paths in the config/application.rb
# require 'mongoid_aliased_field' right after you add the lib/ to autoload path
#
# #Autoload the files in the lib directory
# config.autoload_paths += %W(#{config.root}/lib)
#
# # Require the mongoid_aliased_field monkey patching file explicitly
# require 'mongoid_aliased_field'
# encoding: utf-8
def ಚಿರಕಾಲ_ಸತ್ಯವಾಣಿ_ಹೇಳು
puts "ಸಿರಿಗನ್ನಂಡಂ ಗೆಲ್ಗೆ"
end
def ನಮಸ್ಕಾರಾ_ಹೇಳು
puts "ನಮಸ್ಕಾರಾ ಗುರು.."
end
@sriranggd
sriranggd / git_file_formats.txt
Created August 15, 2011 20:50
Git file formats
Copied from : http://git.rsbx.net/Documents/Git_Data_Formats.txt
20061001.2245
Git Files Data Formats
======================
Copyright (C) 2006 by Raymond S Brand
OBJECTS
-------
@sriranggd
sriranggd / ruby_parser_problem.rb
Created August 14, 2011 23:33
Ruby -- issues with unary + used on strings
$ ./irb
>> def ret_str
>> "hello "
>> end
=> nil
>> @ins_var = "world"
=> "world"
>> ret_str +@ins_var
NoMethodError: undefined method `+@' for "world":String
from (irb):5
@sriranggd
sriranggd / git_index_file_reader.rb
Created August 14, 2011 10:27
Ruby script to read a git index file and write the contents in human readable form
#!/usr/bin/env ruby
# ************************************************************************
# A simple ruby script to read the index file of any git repository
# and dump its contents to a file in a readable format.
#
# This is totally a study tool, written when I was trying to understand
# the git internals.
#
# The file strucutre specification considered is this :
@sriranggd
sriranggd / a_problem_description.txt
Created January 3, 2011 00:06
MongoDB Map-Reduce script for aggregating toppers for every group under different categories
I have a "users" collection with documents like this :
{
name : "Jack"
group: "Group-1"
total : 121
subScores : {
cat1 : 38
cat2 : 42
cat3 : 41
}
@sriranggd
sriranggd / sri_vcf_to_csv.js
Created December 12, 2010 21:05
A Nodejs script to extract name and phone numbers (only) from a bunch of VCF files into a csv file.
#!/usr/bin/node
/**
* Author : Srirang (Brahmana)
* Blog : http://techbrahmana.blogspot.com/
* Site : http://srirang.co.cc/
*
* As it is evident this is an absolutely crude script (The output file path is hardcoded... !!!).
* But this works. I have tried this on the VCF files generated by a Nokia 3600 Slide backup operation.