Skip to content

Instantly share code, notes, and snippets.

View iamrahulroy's full-sized avatar

Rahul Roy iamrahulroy

View GitHub Profile
@iamrahulroy
iamrahulroy / SplitXmlByMessage.java
Created June 9, 2025 07:06
Java xml file parser
import javax.xml.stream.*;
import javax.xml.stream.events.XMLEvent;
import java.io.*;
public class SplitXmlByMessage {
public static void main(String[] args) throws Exception {
String inputFile = "input.xml"; // Path to your XML file
String outputDir = "output_messages"; // Directory to save message files
// Create output directory if it doesn't exist
@iamrahulroy
iamrahulroy / min_substring_window.rb
Created April 19, 2024 13:19
Find minimum substring that has all the distinct chars
def min_substring_window(s, distinct)
return "" if distinct.empty?
# Count the frequency of characters in distinct
count_distinct = Hash.new(0)
distinct.each { |char| count_distinct[char] += 1 }
# Maintain current window count, chars we have and chars we need count
window = Hash.new(0)
have = 0

Keybase proof

I hereby claim:

  • I am iamrahulroy on github.
  • I am rahulroy (https://keybase.io/rahulroy) on keybase.
  • I have a public key ASDK5G1W5UlQMbD36R9sxMYET69dhR0VpSjDah_WkVLbVwo

To claim this, I am signing this object:

@iamrahulroy
iamrahulroy / rails http status codes
Created January 27, 2017 18:34 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
"--------------- Standard settings ------------------
set nocompatible " No compatibility with legacy Vi
set tabstop=2 " a tab is two spaces
set smarttab " Tab should always be smart
set softtabstop=2 " when hitting <BS>, pretend like a tab is removed, even if spaces
set expandtab " expand tabs by default (overloadable per file type later)
set shiftwidth=2 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set autoindent " always set autoindenting on