Skip to content

Instantly share code, notes, and snippets.

View snambi's full-sized avatar

Nambi Sankaran snambi

View GitHub Profile
# create an UDP server using nc on port 11090
nc -ul 11090
# check whether an UDP server is listening on 11190
nc -vz -u <hostname> 11090
# send a packet to the UDP server
echo -n "hello" | nc -4u -w1 <hostname> 1118
@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);