Skip to content

Instantly share code, notes, and snippets.

@aimtiaz11
aimtiaz11 / JwtTokenController.java
Last active March 11, 2025 05:05
Create JWT Token - API Controller
package com.company.controller;
import com.company.model.SuccessResponseModel;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@aimtiaz11
aimtiaz11 / parse-text-file.py
Created June 23, 2024 02:00
Read and Parse Text file into CSV file
# Define the input and output file paths
# UPDATE this accordingly
input_file_path = 'raw-statement-data.txt'
output_file_path = 'csv-statement-data.csv'
def parse_transaction_line(line):
# Split the line into components - UPDATE this based on your line setup
@aimtiaz11
aimtiaz11 / readme.md
Last active June 27, 2024 09:21
Google Sheets - Combining Data From Multiple Sheets

Using Arrays and Sorting (removing blank rows) to combine multiple worksheets into one.

=sort({'Feb24 - Data'!A2:G;'Mar24 - Data'!A2:G;'Apr24 - Data'!A2:G;'May24 - Data'!A2:G;'Jun24 - Data'!A2:G})

Source: This awesome video: https://www.youtube.com/watch?v=CVkyfGUSHeg&t=288s

@aimtiaz11
aimtiaz11 / readme.md
Last active September 29, 2024 02:57
Switching Java versions and runtimes using update-alternatives

Switching Java using update-alternatives

Registering new java version

For example registering GraalVM to update-alternatives.

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/graalvm-jdk-21.0.4+8.1/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/graalvm-jdk-21.0.4+8.1/bin/javac 1
@aimtiaz11
aimtiaz11 / 01-classify-host-int-ext.sh
Last active June 15, 2024 15:20
Useful Networking Scripts
#!/bin/bash
# Define a list of hostnames
HOSTS=(
"google.com:443"
"amazon.com:443"
)
# Iterate through the list of hostnames
@aimtiaz11
aimtiaz11 / readme.md
Last active March 7, 2024 04:58 — forked from thomasdarimont/readme.md
Example for decoding a JWT Payload with your Shell (bash, zsh...)

Decoding a JWT Payload with your Shell (bash, zsh...)

Add this to your .profile, .bashrc, .zshrc...

decode_base64_url() {
  local len=$((${#1} % 4))
  local result="$1"
  if [ $len -eq 2 ]; then result="$1"'=='
  elif [ $len -eq 3 ]; then result="$1"'=' 
 fi
@aimtiaz11
aimtiaz11 / .vimrc
Last active September 23, 2023 12:42
My .vimrc
set tabstop=2
set autoindent
set nu
syntax on
set ignorecase
@aimtiaz11
aimtiaz11 / RenameFilesDirectories.ps1
Last active September 17, 2023 02:20
Powershell - Replace occurance of a word in all files and directories under a parent directory
### DO A DRY RUN AND VERIFY BY COMMENTING OUT LINE 29 BEFORE UNCOMMENTING AND DOING PROPER RUN
### LINE TO COMMENT FOR DRY RUN: --> Rename-Item -Path $item.FullName -NewName $newName
###
## LICENSE MIT
# Define the root directory where you want to rename occurrences of the word
# IMPORTANT: CAREFULLY SET THIS. Otherwise it can have unintended consequences!!!
$rootDirectory = "C:\Users\123\git-repos\my-git-project"
@aimtiaz11
aimtiaz11 / compare-list.groovy
Last active September 13, 2023 14:47
Helpful Groovy Scripts
/**
* Usage: groovy compare-list.groovy first.txt second.txt
**/
def sourceList = []
new File( args[0] ).eachLine { line ->
sourceList << line.trim()
}
@aimtiaz11
aimtiaz11 / curl.sh
Last active February 26, 2025 08:12
Curl - Echo only HTTP status
curl -Iso /dev/null -w "%{http_code}\n" -k https://www.google.com.au