Skip to content

Instantly share code, notes, and snippets.

@nakshay
nakshay / SSHClient.java
Created December 17, 2019 08:13
SSH client in java using Jcraft JSCH library
import com.jcraft.jsch.Channel;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.Session;
public class SSHClient {
public static void main(String[] args) {
try {
JSch jsch = new JSch();
@nakshay
nakshay / Hack.java
Last active February 9, 2020 11:43
hack
//Given a number, in the form of an array a[] containing digits from 1 to 9(inclusive). The task is to find the next smallest palindrome larger than this number.
//
//Input :
//The first line is number of test cases T. Every testcase contains two lines. The first line contains the size of the array, second line contains the digits of the number separated by space.
//
//Output:
//In each separate line print the digits of palindrome with spaces in between.
//
//Constraints:
//1<=T<=100
@nakshay
nakshay / java_rust_generic.md
Created March 6, 2020 03:55 — forked from Kimundi/java_rust_generic.md
A light comparison between Rust and Java generics and type system features.

Introduction

If you are familiar with Java's generics, and are coming to Rust, you might be lead to assume that its generics are working the same way.

However, due to the different type systems, and different implementation details, there are quite a few differences between generic code in both languages.

This document tries to give a short summary about those differences:

Core functionality

Java