Skip to content

Instantly share code, notes, and snippets.

View ningthoujam-lokhendro's full-sized avatar

ningthoujam-lokhendro ningthoujam-lokhendro

View GitHub Profile
enum Currency {
CZK, EUR, GBP
}
abstract class Fund {
Currency currency;
BigDecimal amount;
public Fund() {}
@ningthoujam-lokhendro
ningthoujam-lokhendro / dynmotd.sh
Last active October 4, 2022 12:12 — forked from cha55son/dynmotd
RHEL (Centos/Fedora) dynamic motd
#!/bin/bash
# Installation:
#
# 1. vim /etc/ssh/sshd_config
# PrintMotd no
#
# 2. vim /etc/pam.d/login
# # session optional pam_motd.so
#
#!/usr/bin/env python
import argparse
import fnmatch
import os
import sys
# Recursively generate index.html files for
# all subdirectories in a directory tree
@ningthoujam-lokhendro
ningthoujam-lokhendro / wget.sh
Created October 29, 2019 08:09
Some wget options
# Downloading a single file content can be as easy as
wget http://example.com/abc.zip
# Specify filename on disk
wget http://example.com/abc.zip -O file.zip
# Download a directory
wget -r --no-parent http://mysite.com/xyz/
# Download a directory with no index.html
@ningthoujam-lokhendro
ningthoujam-lokhendro / self-sign.md
Last active December 23, 2019 12:27
Generate Self-Sign Cert and Key. Trust in other system

Generate Self-sign cert and key

openssl req \
    -newkey rsa:2048 \
    -x509 \
    -nodes \
    -keyout server.key \
    -new \
    -out server.pem \
 -subj /CN=ningzeta.com \
@ningthoujam-lokhendro
ningthoujam-lokhendro / generate.sh
Created June 2, 2017 12:51
Generate Certificates and self signed for dev usage
# Generate Private Key
openssl genrsa 1024 > star.example.com.key
# Generate Certificate Signing Request
openssl req -new -key ./star.example.com.key >./star.example.com.csr
# Self Signed the Certificate
openssl x509 -in star.example.com.csr -out star.example.com.crt -req -signkey star.example.com.key -days 365
# Convert to PEM.
@ningthoujam-lokhendro
ningthoujam-lokhendro / oracle-jdk-install.sh
Created May 26, 2016 12:50
Download and install Oracle JDK at Debian, Ubuntu, CentOS
#!/bin/bash
#
# Description: The script installs Oracle JDK from tar.gz file.
# JDK tar.gz file is supposed to be in current directory.
# Script relies on format of archive name, it should be
# jdk-<version>[u<update>]-linux-<architecture>.tar.gz, and the
# directory inside is supposed to be jdk1.<version>.0[_<update>].
# It's a default Oracle's naming convention for JDK tar.gz files.
#
# Supported distributions: Debian, Ubuntu, CentOS.
@ningthoujam-lokhendro
ningthoujam-lokhendro / SimpleErrorController.java
Last active July 27, 2018 06:14
Spring Error Controller
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.beans.factory.annotation.Autowired;
@ningthoujam-lokhendro
ningthoujam-lokhendro / App.java
Created May 13, 2016 17:02
Generate IEEE OUI in JSON format with java.
package com.ningzeta;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.HashMap;
import java.util.Scanner;
@ningthoujam-lokhendro
ningthoujam-lokhendro / jdbcConn
Created May 13, 2016 09:37
JDBC Connection Strings
# IBM DB2
jdbc:db2://<HOST>:<PORT>/<DB>
COM.ibm.db2.jdbc.app.DB2Driver
# JDBC-ODBC Bridge
jdbc:odbc:<DB>
sun.jdbc.odbc.JdbcOdbcDriver
# IDS Server
jdbc:ids://<HOST>:<PORT>/conn?dsn='<ODBC_DSN_NAME>'