Skip to content

Instantly share code, notes, and snippets.

View gansai's full-sized avatar
🎯
Focusing

Ganesh S gansai

🎯
Focusing
View GitHub Profile
@gansai
gansai / HelloWorld.java
Created September 21, 2019 14:58
Java Hello World
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 August 24, 2019 00:31
check for string rotation in java
public class IsRotation {
public static void main(String[] args) {
String a = "ABCD";
String b = "DABC";
System.out.println(isRotation(a,b));
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 July 24, 2016 05:02
List Youtube links from Google Videos Search Result
@gansai
gansai / ReadFile.java
Created November 12, 2015 17:44
Reading a text file in 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 October 11, 2015 08:04
Given an array, find a pair which sums up to a number (Sorted array solution)
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 October 11, 2015 08:03
Given an array and a sum x, find a pair in array which sums up to x. (Brute-force)
/**
* 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 October 5, 2015 18:49
Ruby code to illustrate basic programming
#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 October 4, 2015 15:10
Illustration on how to retrieve home timeline from twitter using Java code
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 October 4, 2015 11:00
Illustration for running Erlang code from Intellij IDEA
-module(hello).
%% API
-export([hello/0]).
hello() -> io:fwrite("Hi. This is my first Erlang Program.\n").