Skip to content

Instantly share code, notes, and snippets.

View chandu-io's full-sized avatar
🎯
Focusing

Chandrasekhar Thotakura chandu-io

🎯
Focusing
  • Hyderabad, INDIA
View GitHub Profile
@chandu-io
chandu-io / ssh-key-based-auth.md
Last active April 24, 2024 06:34
Configure SSH Key-Based Authentication on a Linux Server

Configure SSH Key-Based Authentication on a Linux Server

Configuration on remote machine

For this example, consider itsme as username on remote machine. Make sure you have root access or admin privileges.

  1. Login on to the remote machine by providing password. This should be one time activity, once the key-based authentication is setup you can login without password.
Diff Table
| id | version | patch |
----------------------------
| 1 | 001 | {...} |
| 1 | 002 | {...} |
| 1 | 003 | {...} |
| 2 | 001 | {...} |
| 2 | 002 | {...} |
@chandu-io
chandu-io / TS-Exhaustive-Type-Check.ts
Last active September 21, 2019 14:46
ts :: exhaustive type checking - `Extract`
// Inspired from article
// https://medium.com/@wittydeveloper/typescript-super-types-62ca18810730
type Square = { kind: 'square'; side: number };
type Rectangle = { kind: 'rectangle'; width: number; length: number };
type Circle = { kind: 'circle'; radius: number };
type Shape = Square | Rectangle | Circle;
type ShapeKind = Shape['kind'];
@chandu-io
chandu-io / Functions.java
Last active February 2, 2019 03:32
java :: Utility mapper class with methods mapping checked exceptions to unchecked exceptions
package com.example.function;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* Utility mapper class with methods mapping checked exceptions to unchecked exceptions
*
* @author Chandrasekhar Thotakura
@chandu-io
chandu-io / 1-Editor-Settings.txt
Last active January 8, 2016 15:43
eclipse :: Code Formatters
Text Editor Settings
------------------------
General > Editors > Text Editors
Displayed tab width: 2
Insert spaces for tabs: true
Show print margin: true
Print margin column: 120
Show line numbers: true
HTML Formatting Settings

PSQL commands

  1. List all schemas
\dn
  1. List all tables (regular expressions are available)
@chandu-io
chandu-io / youtube.css
Last active October 29, 2015 13:40
css :: youtube stylebot styling for Google Chrome
#eow-title {
display: block;
font-size: 12px;
}
#player-api, .player-height {
height: 50px;
}
#watch-header {
@chandu-io
chandu-io / ReflectionReference.java
Created October 29, 2015 03:18
java :: getReference
/**
* This method will return the reference to the internal private/protected/public/default fields of the given object.
* This method can go as deeper as needed; with the passed `fields` parameter.
* The parameter `fields` array follows order from outer `object variable name` to `inner variable name`
* See below example:
* - getReference(obj, "var", "var", "var:list:0", "var:array:0", ">>var", "var:map:custom_key", "var:set:1")
*/
public static Object getReference(final Object obj, final String... fields) throws Exception {
if (fields.length < 1 || fields[0] == null) {
return obj;
@chandu-io
chandu-io / PrimeSeries.java
Created June 20, 2015 00:04
java :: Prime series generator (prime number)
import java.util.*;
public class PrimeSeries {
public static void main(String[] tcs) throws Exception {
if (tcs.length < 1) {
log("Invalid limit. Terminating...");
return;
}
long limit = Long.parseLong(tcs[0]);
@chandu-io
chandu-io / open-youtube-links-fullscreen.js
Created January 30, 2015 01:09
bookmarklet :: open youtube links fullscreen