Skip to content

Instantly share code, notes, and snippets.

View snambi's full-sized avatar

Nambi Sankaran snambi

View GitHub Profile
@snambi
snambi / springdocs.md
Last active November 16, 2023 22:01
springdocs.md
@snambi
snambi / JWTGenerator.Java
Created September 18, 2023 16:15
Generate JWT Using Java
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.nio.charset.StandardCharsets;
import java.security.PrivateKey;
import java.security.SecureRandom;
import java.security.Signature;
import java.text.MessageFormat;
@snambi
snambi / helm_repo_gitlab.md
Created July 25, 2023 23:10
Helm repository in gitlab

Create a personal token to deploy to helm repo

  • Go to Settings -> Access Tokens in your gitlab project
  • Add new token name, choose validtity, choose role as "maintainer", select scopes as "api, read_api"
  • Click on "create project access token"
  • Copy the created token in safe location.

Add gitlab package repo to helm

@snambi
snambi / dynamo-json-2-json.md
Created July 18, 2023 04:02
Convert DynamoDB JSON to regular JSON
@snambi
snambi / podman-setup.md
Last active July 9, 2023 18:13
Podman Volume setup

Podman

Rootless Podman setup with volume.

create podman machine

❯ podman machine init --cpus=4 --memory=4096 -v /Users/snambi/.secrets:/mnt/secrets
Downloading VM image: fedora-coreos-38.20230514.2.0-qemu.aarch64.qcow2.xz: done
Extracting compressed file
@snambi
snambi / javascript-fetch.md
Last active July 6, 2023 01:53
Javascript Fetch

Javascript fetch

fetch('https://mydomain.com/path/to/resource/v1', 
  { method: 'POST', 
    headers: {'Content-Type': 'application/json'},
    body : JSON.stringify( { 'name': 'john' } )
  } 
 ).then( res => res.json() 
 ).then( console.log);
@snambi
snambi / awk-better-than-cut.md
Last active June 26, 2023 21:03
How to extract different fields from a CSV file and print in a different format

awk is better than cut

How to extract different fields from a CSV file and print in a different format

Input file in CSV format

Sample input file

837998483934.ecr.us-west-2.amazonaws.com,consoleapi,1.0.0-fg47d32
@snambi
snambi / add-usb.md
Last active March 11, 2022 04:50
Add an external USB drive permanently to Ubuntu
  1. Attach the USB drive to computer.
  2. Note the ID of the device
    # use lsblk to list the devices
    lsblk
    NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    loop0         7:0    0     4K  1 loop /snap/bare/5
    loop1         7:1    0  97.7M  1 loop /snap/core/12726
    sda           8:0    0 931.5G  0 disk

└─sda1 8:1 0 931.5G 0 part /media/ncdrive