Skip to content

Instantly share code, notes, and snippets.

View pethaniakshay's full-sized avatar
🎯
Focusing

Akshay Pethani pethaniakshay

🎯
Focusing
View GitHub Profile
@pethaniakshay
pethaniakshay / ExecuteDOSCommand.java
Created October 29, 2016 06:34
Run DOS Commands Using the Java Program
import java.io.IOException;
import java.io.InputStream;
public class ExecuteDOSCommand {
public static void main(String[] args) {
final String dosCommand = "ipconfig";
try {
final Process process = Runtime.getRuntime().exec(dosCommand );
final InputStream in = process.getInputStream();
int ch;
@pethaniakshay
pethaniakshay / ArrayListMatrix.java
Last active May 20, 2017 09:25
matrix using java 2-D ArrayList collection class
import java.util.*;
public class ArrayListMatrix {
public static void main(String args[]){
List<ArrayList<Integer>> a = new ArrayList<>();
ArrayList<Integer> a1 = new ArrayList<Integer>();
ArrayList<Integer> a2 = new ArrayList<Integer>();
@pethaniakshay
pethaniakshay / SpiralOrderMatrix.java
Created December 7, 2016 17:23
Given a matrix of m * n elements (m rows, n columns), return all elements of the matrix in spiral order. Example: Given the following matrix: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ] You should return [1, 2, 3, 6, 9, 8, 7, 4, 5]
package interviewbitProgramming;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
/**
* Created by Akshay Pethani on 2016-12-06.
*
* Detailed Problem can be found on following link:
@pethaniakshay
pethaniakshay / FolderShortcutHealer.bat
Created December 7, 2016 18:15
Batch file to remove shortcut virus from removable disks.
@echo off
color 02
echo.
echo ==========================
echo Folder Shortcut Healer
echo ==========================
echo.
echo.
echo CREATED BY AKSHAY PETHANI
echo.
package interviewbitProgramming;
import java.util.ArrayList;
import java.util.Scanner;
public class MinStepsInInfiniteGrid {
public static void main(String args[]){
System.out.println("Enter the No of Points: ");
@pethaniakshay
pethaniakshay / FindDuplicateInArray.java
Last active May 26, 2017 10:00
Find Duplicate In Array Soltution.Without recursion and using most simplest way.
import java.util.*;
public class FindDuplicateInArray {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
System.out.println("Enter the No of elements: ");
int size =sc.nextInt();
@pethaniakshay
pethaniakshay / button.h
Created March 2, 2017 17:55
Sudoku Puzzel with Solver Program.
#include<iostream.h>
#include<conio.h>
#include<graphics.h>
class Button
{
private: int midx;
int midy;
int length;
int color;
char *name;
@pethaniakshay
pethaniakshay / SendMail.java
Last active May 26, 2017 13:58
Java Program to send Email through SMTP server of Gmail. API used: Java Mail API by Oracle.
import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;
class Mailer{
public static void send(String from,String password,String to,String sub,String msg){
//Get properties object
Properties props = new Properties();
props.put("mail.smtp.host", "smtp.gmail.com");
props.put("mail.smtp.socketFactory.port", "465");
public class ConsoleOutputColorChangeDemo {
public static final String RESET = "\u001B[0m";
public static final String BLACK = "\u001B[30m";
public static final String RED = "\u001B[31m";
public static final String GREEN = "\u001B[32m";
public static final String YELLOW = "\u001B[33m";
public static final String BLUE = "\u001B[34m";
public static final String PURPLE = "\u001B[35m";
public static final String CYAN = "\u001B[36m";
@pethaniakshay
pethaniakshay / VigenerCipher.java
Created May 20, 2017 10:08
Implementation of the Vigenere Cipher In Java
import java.util.Scanner;
public class VigenereCipher {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
String plainText;
int i,j,p;
String key;