Skip to content

Instantly share code, notes, and snippets.

View ashwanthkumar's full-sized avatar

Ashwanth Kumar ashwanthkumar

View GitHub Profile
@ashwanthkumar
ashwanthkumar / compiler.php
Created November 22, 2011 05:09
Mini Online Judge script - 22/11/2011
<?php
/**
* My mini online judge script in php. This was done as a part of 6 hour hackathon.
*
* @author Ashwanth Kumar
* @version 0.1
* @date 22/11/2011
**/
/**
There are things to note here as,
@ashwanthkumar
ashwanthkumar / RajKamalBookCorrectPages.java
Created November 28, 2011 21:49
Correct the page layout in Raj Kamal book, available on the internet.
import java.io.FileOutputStream;
import java.io.IOException;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.pdf.PdfDictionary;
import com.itextpdf.text.pdf.PdfName;
import com.itextpdf.text.pdf.PdfNumber;
import com.itextpdf.text.pdf.PdfReader;
import com.itextpdf.text.pdf.PdfStamper;
@ashwanthkumar
ashwanthkumar / gist:3806212
Created September 30, 2012 07:53 — forked from anonymous/gist:3805751
The Ying-Yang of CEOs and Engineers

The Ying-Yang of CEOs and Engineers

All successful startups begin with two founders. One guy is the Engineer, and the other guy is the business dude. Over the years of working with various people, I've learned what makes a good engineer, and what makes a good business dude, and the two are complete opposites of each other.

CEO Engineer
@ashwanthkumar
ashwanthkumar / HBaseSelectiveImport.java
Created December 5, 2012 05:30
Hacked HBase 0.92.1 Import MR to selectively import rows into HBase
/**
* Copyright 2009 The Apache Software Foundation
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
@ashwanthkumar
ashwanthkumar / HFileInputFormat.scala
Last active December 14, 2015 18:59 — forked from coltfred/HFileInputFormat.scala
Updating the HFile Reader init for HBase 0.94.2 - Fixing the null CacheConfig
import org.apache.hadoop.fs.Path
import org.apache.hadoop.hbase.io.hfile.{ HFile, HFileScanner, CacheConfig }
import org.apache.hadoop.hbase.io.hfile.HFile.Reader
import org.apache.hadoop.hbase.io.ImmutableBytesWritable
import org.apache.hadoop.hbase.KeyValue
import org.apache.hadoop.mapreduce.{ JobContext, InputSplit, TaskAttemptContext, RecordReader }
import org.apache.hadoop.mapreduce.lib.input.{ FileInputFormat, FileSplit }
import org.apache.hadoop.hbase.regionserver.metrics.SchemaMetrics
/**
@ashwanthkumar
ashwanthkumar / HFileInputFormat.java
Created March 11, 2013 11:55
A MapReduce InputFormat for HBase's HFile. - Tested on HBase 0.94.2 and Hadoop 1.0.1
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.io.hfile.CacheConfig;
import org.apache.hadoop.hbase.io.hfile.HFile;
import org.apache.hadoop.hbase.io.hfile.HFileScanner;
import org.apache.hadoop.hbase.regionserver.metrics.SchemaMetrics;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
@ashwanthkumar
ashwanthkumar / MetaInfo.rb
Created March 14, 2013 05:34
HRegionInfo was null or empty in .META.
include 'Java'
...
admin = HBaseAdmin.new(HBaseConfiguration.create)
table_regions = admin.getTableRegions(Bytes.toBytes("test_table"))
table_regions.each do |table_region|
puts "#{table_region.getRegionNameAsString())}"
}
struct Vehicle {
1: string name
2: string model
}
struct Person {
1: string name
2: i32 age
// Empty collections can be specified using []. Same works for map and set as well.
3: list<Vehicle> cars = []
@ashwanthkumar
ashwanthkumar / InstallCert.java
Last active August 29, 2015 14:00
Adding the mv command to move the generate 'jssecacerts' file to right location
/*
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
@ashwanthkumar
ashwanthkumar / FixedPointJob.scala
Created June 12, 2014 16:53
User Identifier Normalization from Big Data book by Nathan Marz implementated in Scalding.
import com.twitter.scalding.{Tsv, Job, Args}
import scala.collection.immutable.TreeSet
/*
Lets assume we are reading a file of format (a,b) where a,b denote that node a and node b are connected in a graph.
For simplicity we will assume that a and b are ints. We want to find the mapping of all the nodes on a fixed point.
*/
class FixedPointJob(args: Args) extends Job(args) {
val input = args("input")
val outputBaseDir = args("output-base-dir")