Skip to content

Instantly share code, notes, and snippets.

View irfanbaigse's full-sized avatar
👨‍💻
JAVA - AWS - Flutter - MT5/MT4 - PHP - Node.js

Irfan Baig irfanbaigse

👨‍💻
JAVA - AWS - Flutter - MT5/MT4 - PHP - Node.js
View GitHub Profile
@irfanbaigse
irfanbaigse / PostmanDecodeJWT.js
Created May 31, 2024 10:45 — forked from jeff-heienickle/PostmanDecodeJWT.js
Decode, reuse, and visualize a JWT in Postman
var jsonData = pm.response.json();
pm.environment.set("jwt", jsonData.access_token);
function parseJwt (token,part) {
var base64Url = token.split('.')[part];
var words = CryptoJS.enc.Base64.parse(base64Url);
var jsonPayload = CryptoJS.enc.Utf8.stringify(words);
return JSON.parse(jsonPayload);
};
@irfanbaigse
irfanbaigse / HealthCheckController.java
Created January 23, 2024 11:28
Spring Boot Health Check Api Controller
package com.example.irfan.rest;
import org.springframework.boot.actuate.health.HealthEndpoint;
import org.springframework.http.MediaType;
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;
@RestController
@irfanbaigse
irfanbaigse / mvnw-fix.sh
Created January 2, 2024 11:04 — forked from kbastani/mvnw-fix.sh
Adds a settings.xml file to your Spring Boot maven wrapper
#!/usr/bin/env bash
# Secure workaround for https://issues.sonatype.org/browse/MVNCENTRAL-1369
# Navigate to the root of your Spring Boot project where a Maven wrapper is present and run this script
cd .mvn/wrapper
wget https://gist.githubusercontent.com/kbastani/d4b4c92969ec5a22681bb3daa4a80343/raw/f166086ef051369383b02dfb74317cd07b6f2c6e/settings.xml
cd ../../
./mvnw clean install -s .mvn/wrapper/settings.xml
@irfanbaigse
irfanbaigse / udemy.js
Created December 13, 2023 12:47
Udemy exapnd all and mark as complete
## Expand
const sectionEl = document.querySelector("section[data-purpose='sidebar']"); const checkboxes = sectionEl.querySelectorAll("input[type='checkbox']"); checkboxes.forEach((checkbox) => { if (!checkbox.checked) { checkbox.disabled = false; checkbox.click(); } });
## Mark as Complete
const checkboxes = document.querySelectorAll("input[type='checkbox']");
checkboxes.forEach((checkbox) => {
if(!checkbox.checked) {
checkbox.click();}})
# Find add 'node_modules'
find . -name "node_modules" -type d -prune -print | xargs du -chs
# Delete all
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
@irfanbaigse
irfanbaigse / mongo-local-apple-silicon.sh
Last active August 10, 2023 22:01
Small mongodb image for local use
#https://github.com/Ortanon/mongo
docker pull karimtemple/mongo
mkdir db && sudo chmod 777 db
docker run --platform linux/amd64 --name mongodb --rm -d -p 27017:27017 --user 202:202 -v $(pwd)/db:/data/db karimtemple/mongo
@irfanbaigse
irfanbaigse / prepare-commit-msg
Created November 28, 2022 12:59
add branch name to the commit message -- go to .git/hooks/prepare-commit-msg and replace the file
#!/bin/bash
#
# Automatically adds branch name and branch description to every commit message.
# Modified from the gist here https://gist.github.com/bartoszmajsak/1396344
#
# This way you can customize which branches should be skipped when
# prepending commit message.
RED="\033[1;31m"
GREEN="\033[1;32m"
@irfanbaigse
irfanbaigse / ext-xdebug.ini
Created January 13, 2022 06:35
php xdebug config for phpstorm mac
# subl /usr/local/etc/php/7.3/conf.d/ext-xdebug.ini
[xdebug]
xdebug.mode = debug
xdebug.max_nesting_level = 1000
xdebug.start_with_request=yes
xdebug.client_port=9090
xdebug.client_host=127.0.0.1
xdebug.discover_client_host=1
xdebug.idekey=PHPSTORM
@irfanbaigse
irfanbaigse / local-valet-drvier.php
Created January 13, 2022 06:22
Local Laravel / Lumen Valet Driver
<?php
// paste this file in root folder of your project
// and run command "valet link ."
class LocalValetDriver extends LaravelValetDriver
{
/**
* Determine if the driver serves the request.
*
@irfanbaigse
irfanbaigse / install.sh
Created January 11, 2022 12:40 — forked from aaabramov/install.sh
Installing zsh + oh-my-zsh on Amazon EC2 Amazon Linux 2 AMI. (Prepared in the scope of posting https://aaabramov.medium.com/installing-zsh-oh-my-zsh-on-amazon-ec2-amazon-linux-2-ami-88b5fc83109)
sudo yum update
# Installing ZSH
sudo yum -y install zsh
# Check ZSH has been installed
zsh --version
# Install "util-linux-user" because "chsh" is not available by default
# See https://superuser.com/a/1389273/599050