Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Ganesh Swamypillai gansai

🎯
Focusing
Block or report user

Report or block gansai

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
View HelloWorld.java
package com.sample.code.java;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
@gansai
gansai / IsRotation.java
Last active Aug 24, 2019
check for string rotation in java
View IsRotation.java
public class IsRotation {
public static void main(String[] args) {
String a = "ABCD";
String b = "DABC";
System.out.println(isRotation(a,b));
View JavaOnJupyterNotebook.txt
Please follow below steps to use Java on Jupyter Notebook, to experiment Java code on browser and share snippets with others for trying out.
Please note that this is for windows environment.
1. Install Anaconda for Windows from https://www.anaconda.com/download/
2. After installation of Anaconda, open Anaconda Navigator and install Jupyter Notebook
3. Download java kernel from https://github.com/SpencerPark/IJava/releases/download/v1.2.0/ijava-1.2.0.zip
4. Extract ijava-1.2.0.zip file
@gansai
gansai / ListYoutubeLinks.js
Created Jul 24, 2016
List Youtube links from Google Videos Search Result
View ListYoutubeLinks.js
@gansai
gansai / ReadFile.java
Created Nov 12, 2015
Reading a text file in Java
View ReadFile.java
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
/**
* Created by gansai on 12/11/15.
* Referred to http://stackoverflow.com/a/4716623
*/
public class ReadFile {
@gansai
gansai / FindPairSum_Sorted.java
Created Oct 11, 2015
Given an array, find a pair which sums up to a number (Sorted array solution)
View FindPairSum_Sorted.java
import java.util.*;
/**
* Created by gansai on 11/10/15.
*/
public class FindPairSum_Sorted {
public static void main(String args[])
{
Integer array[] = new Integer[] { 1, 43, 2, 55, 21, 87, 9 };
@gansai
gansai / FindPairSum_Brute.java
Last active Oct 11, 2015
Given an array and a sum x, find a pair in array which sums up to x. (Brute-force)
View FindPairSum_Brute.java
/**
* Created by gansai on 11/10/15.
*/
public class FindPairSum_Brute {
public static void main(String args[])
{
int array[] = new int[] { 1, 43, 2, 55, 21, 87, 9 };
int sum = 76;
boolean foundPair = false;
@gansai
gansai / first.rb
Created Oct 5, 2015
Ruby code to illustrate basic programming
View first.rb
#This is my first Ruby code
print "Hi Everyone. How are you?"
puts "Enter a value"
num = gets.to_i
puts "Enter another value"
num_2 = gets.to_i
puts num.to_s + " + " + num_2.to_s + " = " + (num + num_2).to_s
@gansai
gansai / TweetMain.java
Last active Oct 4, 2015
Illustration on how to retrieve home timeline from twitter using Java code
View TweetMain.java
import java.util.List;
import twitter4j.Status;
import twitter4j.Twitter;
import twitter4j.TwitterException;
import twitter4j.TwitterFactory;
import twitter4j.conf.ConfigurationBuilder;
public class TweetMain {
public static void main(String[] args) {
@gansai
gansai / hello.erl
Created Oct 4, 2015
Illustration for running Erlang code from Intellij IDEA
View hello.erl
-module(hello).
%% API
-export([hello/0]).
hello() -> io:fwrite("Hi. This is my first Erlang Program.\n").
You can’t perform that action at this time.