Skip to content

Instantly share code, notes, and snippets.

View reflexdemon's full-sized avatar

Venkateswara Venkatraman Prasanna reflexdemon

View GitHub Profile
@reflexdemon
reflexdemon / ssl_keytool.md
Last active July 27, 2019 11:21
Downloading PEM certificate using OpenSSL and importing to Java TrustStore

Download the Certificate using OpenSSL Command

echo "" | openssl s_client -connect server-that-you-want-to-connect:port -showcerts 2>/dev/null | openssl x509 -out cert.pem

Import the downloaded certificate using Java 11 to truststore

keytool -import -storepass changeit -noprompt -file cert.pem -cacerts
@reflexdemon
reflexdemon / rubix_2x2_solution.md
Last active September 10, 2019 19:39
Solve 2x2 Rubiks cube

Overview

While I was trying to solve the Rubix Cube 2x2 all by myself, found it really challenging. Then bit of help from Google and Youtube, I got the working formula and wanted to share it with everyone.

Solve for 3 colors

Prerequisites

  • Make sure you have 3 whites together.
@reflexdemon
reflexdemon / clean_up.md
Last active March 13, 2020 14:56
recover /boot space

I recently was trying to boot my old linux mint laptop and got a error message that my /boot was full. I did google for the solution and finally found a way to claim the space by removing old and unused space by just using the below script.

#!/usr/bin/env bash

OLDCONF=$(dpkg -l|grep "^rc"|awk '{print $2}')
CURKERNEL=$(uname -r|sed 's/-*[a-z]//g'|sed 's/-386//g')
LINUXPKG="linux-(image|headers|ubuntu-modules|restricted-modules)"
METALINUXPKG="linux-(image|headers|restricted-modules)-(generic|i386|server|common|rt|xen)"
OLDKERNELS=$(dpkg -l|awk '{print $2}'|grep -E $LINUXPKG |grep -vE $METALINUXPKG|grep -v $CURKERNEL)
@reflexdemon
reflexdemon / generate_uaa_keypair.sh
Created February 19, 2019 12:33 — forked from bijukunjummen/generate_uaa_keypair.sh
Generate a Signing Key and Verification Key for Cloud Foundry UAA
#!/bin/bash
openssl genrsa -out privkey.pem 2048
openssl rsa -pubout -in privkey.pem -out pubkey.pem
SIGNING_KEY=$(cat privkey.pem)
VERIFICATION_KEY=$(cat pubkey.pem)
JWT_SIGNING_KEYS=$(cat <<EOF
jwt:
token:
@reflexdemon
reflexdemon / open-ssl-selfsigned-cert.md
Created February 8, 2019 15:20
Create Open SSL self signed Certificate Steps

Run the following OpenSSL command to generate your private key and public certificate. Answer the questions and enter the Common Name when prompted.

openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem

Review the created certificate:

openssl x509 -text -noout -in certificate.pem

Combine your key and certificate in a PKCS#12 (P12) bundle:

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
/**
* The Class URLDownloader.
@reflexdemon
reflexdemon / ClearLine.java
Last active April 6, 2018 00:23
Test program to clear line
public class ClearLine {
public static void main(String[] argv) throws Exception {
//https://stackoverflow.com/questions/7522022/how-to-delete-stuff-printed-to-console-by-system-out-println?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
// int count = 1;
// System.out.print(String.format("\033[%dA",count)); // Move up
// System.out.print("\033[2K"); // Erase line content
System.out.print("hello");
@reflexdemon
reflexdemon / update-remote.md
Created January 22, 2018 03:13
Heroku Update GIT Remote

Step 1: Remove the remote

git remote rm heroku                                    

Step 2: Set the remote to the Project's GIT

@reflexdemon
reflexdemon / launch.json
Last active March 17, 2018 03:15
VS Code Angular 4 Debug:Angular CLI
{
"noteComment": "I copied this from https://stackoverflow.com/questions/42495655/how-to-debug-angular-with-vscode",
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:4200",
"webRoot": "${workspaceRoot}",
@reflexdemon
reflexdemon / Vagrantfile
Created July 16, 2017 02:59
Java 9 Mongo Node JS
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at