Skip to content

Instantly share code, notes, and snippets.

View amithgc's full-sized avatar
🎯
Focusing

Amith Chandrappa amithgc

🎯
Focusing
View GitHub Profile
#!/bin/bash
# Generate a Github Personal Access token and use it here
API_TOKEN="<YOUR GITHUB TOKEN>"
#Update the URL Below
GITHUB_URL="https://api.github.com/repos/<USER NAME>/<REPO NAME>"
# Getting the Base64 for your image
@amithgc
amithgc / LoggingAspect.java
Last active August 13, 2021 13:00
Java Class to Track API Response Time and push the data to INfluxDB
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.util.StopWatch;
import java.io.DataOutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
@amithgc
amithgc / plex-imdb.js
Last active August 13, 2021 07:55
Node-RED Javascript to fetch images for PLEX
var messageContent = "";
if(msg.payload.includes ("playing")) {
messageContent = "Now Playing on PLEX: " + msg.session.title + " (" + msg.session.year + ")";
} else if(msg.payload.includes ("stopped")) {
messageContent = "Stopped Playing on PLEX: " + msg.session.title + " (" + msg.session.year + ")";
}
if(msg.payload.includes ("playing")) {
@amithgc
amithgc / notify-on-ssh-login.sh
Created August 10, 2021 09:29
Telegram Message on SSH
#!/bin/bash
TOKEN="<BOT_TOKEN>"
ID="<GROUP_CHAT_ID>"
URL="https://api.telegram.org/bot$TOKEN/sendMessage"
if [ "$PAM_TYPE" != "open_session" ]
then
exit 0
else
@amithgc
amithgc / install-kong-docker
Created July 8, 2021 09:58
Install Kong and Kong Dashboard in docker
#Install Postgres Database
docker run -d --name kong-database \
-p 5432:5432 \
-e "POSTGRES_USER=kong" \
-e "POSTGRES_DB=kong" \
-e "POSTGRES_PASSWORD=kong" \
postgres:9.6
# DB Migration
docker run --rm \
@amithgc
amithgc / sendEmail.sh
Last active December 21, 2023 06:01
Send EMAIL via SendGrid API using Shell Script
#!/bin/bash
# Author: Amith Chandrappa
# Usage
# Options:
# -t: To Emails, Separated by ";"
# -c: CC Emails, Separated by ";"
# -b: BCC Emails, Separated by ";"
# -s: Subject
# -o: Email body