Skip to content

Instantly share code, notes, and snippets.

View SanthoshBabuMR's full-sized avatar
💫
Give me 6 hours to chop down a tree & I'll spend the first 4 sharpening the axe.

Santhosh Babu SanthoshBabuMR

💫
Give me 6 hours to chop down a tree & I'll spend the first 4 sharpening the axe.
View GitHub Profile
@SanthoshBabuMR
SanthoshBabuMR / find_str_in_sent.js
Last active June 2, 2020 00:12
Find 'aeiou' in sentence
function smallestSubStr(sentence, str) {
if(!sentence || !str) { return null; }
let searchStrIndex = 0;
let startsAtIndex;
let smallestSubStrMap = {
len: Number.MAX_SAFE_INTEGER,
text: null
};
@SanthoshBabuMR
SanthoshBabuMR / oracle_docker_setup.md
Last active May 20, 2020 09:37
Oracle Docker Setup With HR Schema
select * from V$version;
## DB Version
desc hr.employees;
-- shortcut: select table_name and hit: shift + f4
info hr.employees;
info+ hr.employees;
-- additional info to desc cmd
-- primary key, cols(min,max,distinct), default, comments, indexes references
@SanthoshBabuMR
SanthoshBabuMR / js-binary-search-tree-impl.js
Last active May 26, 2020 05:04
Binary Search Tree Implementation with JavaScript
// https://www.youtube.com/watch?v=gcULXE7ViZw
// TreeHouse: delete node : https://www.youtube.com/watch?v=5cU1ILGy6dM
class Node {
constructor(value){
this.left = null;
this.right = null;
this.value = value;
}
}
@SanthoshBabuMR
SanthoshBabuMR / SQL cheatsheet.sql
Last active May 12, 2020 01:33
SQL cheatsheet
-- ##
-- Basic Queries & Operators
-- ##
SELECT column1, column2 FROM table;
-- Query data in columns column1, column2 from a table.
SELECT * FROM table;
-- Query all rows and columns from a table
@SanthoshBabuMR
SanthoshBabuMR / hashmap-to-list.java
Created May 10, 2020 14:49
HashMap to List (java)
import java.util.*;
public class HashMapToList {
public static void main(String[] args) {
HashMapToList hashMapToList = new HashMapToList();
hashMapToList.init();
}
private void init() {
List<User> users = toList(getData());
@SanthoshBabuMR
SanthoshBabuMR / nginx_reverse_proxy.bash
Last active May 5, 2020 02:02
nginx: setup reverse proxy ( Reroute all requests at port 8443 to a different IP:port )
# install nginx
apt-get update
apt-get install nginx
unlink /etc/nginx/sites-enabled/default
# configure
cat > /etc/nginx/sites-available/reverse-proxy.conf
server {
listen 8443;
@SanthoshBabuMR
SanthoshBabuMR / rdp.md
Created May 2, 2020 00:57
Remote Desktop Connect from MAC using MS RDP and log into a Ubuntu System
  • Instructions

    • MAC
      • Have Microsoft Desktop App installed on MAC
      • Configure the Ubuntu PC by host name or IP address from within the LAN network
    • Ubuntu
      • sudo apt install xrdp
      • sudo systemctl enable xrdp
  • Ref

@SanthoshBabuMR
SanthoshBabuMR / openshift_docker_playground.bash
Last active May 4, 2020 07:39
Setup Openshift in Docker
-- get centos image
docker pull centos
-- run with interactive shell
-- docker run -it --name minishift centos /bin/bash: centos has issues with running serivce
docker run -it --name minishift phusion/baseimage /bin/bash -- Ubuntu 16.04.3 LTS
-- check OS name/version
cat /etc/*-release
-- if service is unavailable in docker centos
yum -y install initscripts && yum clean all
@SanthoshBabuMR
SanthoshBabuMR / JacksonJSONAnnotations.java
Last active April 27, 2020 15:48
Convert Stringified JSON to POJO using Jackson's ObjectMapper
package com.babusa.learn.json;
import com.fasterxml.jackson.annotation.*;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;