Skip to content

Instantly share code, notes, and snippets.

@girishrau
girishrau / ssh.md
Created January 8, 2021 14:26
[ssh] SSH commands #ssh #keys

Generate an RSA key pair

$ ssh-keygen -t rsa -b 2048 -C "email@example.com"

Output the public key in the PEM format

$ ssh-keygen -f ~/.ssh/id_rsa.pub -m PEM -e
@girishrau
girishrau / openssl-sign-verify.md
Last active January 11, 2021 15:02
[openssl commands] Sign a file, verify a signature etc. using openssl #openssl #encryption

Sign a file using the private key

  1. Sign a file input-file.txt and base64 encode it for sharing.
$ openssl dgst -sha256 -sign ~/.ssh/id_rsa input-file.txt | base64 > signb64.txt

Alternatively

$ openssl dgst -sha256 -sign ~/.ssh/id_rsa -out sign.sha256 input-file.txt
$ openssl base64 -in sign.sha256 -out <signature>
@girishrau
girishrau / dircolors.md
Last active September 25, 2018 15:17
[Fix dircolors] Fix dircolors for OW #zsh #bash
@girishrau
girishrau / linux-cmds.md
Created September 5, 2018 21:52
[Linux Tips] Commands for some common usage #linux

Find the sizes of immediate subdirectories under the current directory

$ find ./ -maxdepth 1 -type d | xargs du -kh -d 1
@girishrau
girishrau / debugPkgUsage.sql
Last active October 13, 2017 14:28
[Debug PL/SQL Procedure] Function to collect variables into a debug table #sql
------------------------------------------
set echo off
set serveroutput on
set timing off
set pages 25
column VAR_NAME format a50;
column VAR_TEXT_VALUE format a75;
column VAR_NUM_VALUE format 9999999999;
column TIMESTAMP format a33;
@girishrau
girishrau / dockerCommands.md
Last active January 20, 2023 21:50
[Docker commands] Docker commands #docker

List all stopped containers

docker ps -a -f status=exited

Delete all stopped containers

docker rm $(docker ps -a -f status=exited -q)
@girishrau
girishrau / mergetool.md
Last active October 2, 2018 00:35
[Git Diff/Merge] Configure merge tool #git
$ git config --global merge.tool bc3
$ git config --global mergetool.bc3.path /bin/bcompare
@girishrau
girishrau / grub2
Last active October 13, 2017 13:43
[Grub2] Change the default boot kernel #grub #linux
1. Generate the up to date grub configuration
$ grub2-mkconfig -o /boot/grub2/grub.cfg
2. Get the boot sequence of the kernels in the grub configuration
$ grep '^menuentry' /boot/grub2/grub.cfg
This will show the sequence in which the kernels are displayed