Skip to content

Instantly share code, notes, and snippets.

View rajathithan's full-sized avatar

Rajathithan Rajasekar rajathithan

View GitHub Profile
@rajathithan
rajathithan / router-down.py
Last active October 12, 2022 23:41
Router down
# Author - Rajathithan Rajasekar
import base64
import json
from datetime import datetime
from google.cloud import storage
import requests
def process_log_entry(data, context):
data_buffer = base64.b64decode(data["data"])
@rajathithan
rajathithan / router-up.py
Last active May 18, 2020 16:58
router up
# Author - Rajathithan Rajasekar
import base64
import json
from datetime import datetime
from google.cloud import storage
import requests
def process_log_entry(data, context):
data_buffer = base64.b64decode(data["data"])
# Author - Rajathithan Rajasekar
import base64
import json
from datetime import datetime
from google.cloud import storage
import requests
def process_log_entry(data, context):
data_buffer = base64.b64decode(data["data"])
@rajathithan
rajathithan / startupscript.sh
Last active October 7, 2022 16:52
startupscript
#! /bin/bash
# Author - Rajathithan Rajasekar
# install gcp logging agent
curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh
sudo bash install-logging-agent.sh
# setup a configuration for startup-script logs only
sudo cat > /etc/google-fluentd/config.d/service-now-test.conf <<- EOM
<source>
@rajathithan
rajathithan / retrieve-compute-engine-details.py
Last active September 16, 2022 16:53
retrieve-compute-engine-details
# Script to retrieve compute engine details.
# Author - Rajathithan Rajasekar - 03/03/2020
from pprint import pprint
from googleapiclient import discovery
from oauth2client.client import GoogleCredentials
import re
import sys
@rajathithan
rajathithan / compute-engine-details.sh
Last active April 17, 2023 10:15
compute-engine-details
#!/bin/bash
# Script to retrieve compute engine details.
# Author - Rajathithan Rajasekar - 03/03/2020
echo "PROJECT NAME, INSTANCE NAME , ZONE , MACHINE-TYPE , OPERATING SYSTEM , CPU , MEMORY , DISK SIZE" > compute-engine-details.csv
prjs=( $(gcloud projects list | tail -n +2 | awk {'print $1'}) )
for i in "${prjs[@]}"
do
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@" >> list.txt
echo "Setting Project: $i" >> list.txt
import cv2
import imutils
cap = cv2.VideoCapture(0)
t = cv2.getTickCount()
count = 0
fps = 60.0
while(True):
@rajathithan
rajathithan / 68-point-face-detection.py
Created May 8, 2020 23:07
Dlib's 68 point face detection
import cv2
import imutils
import dlib
import sys
from renderface2 import renderFace2
# Capture the webcam feed
cap = cv2.VideoCapture(0)
# 68 point face model
@rajathithan
rajathithan / polylines.py
Last active May 28, 2020 15:04
opencv polylines
def drawPolyline(im, landmarks, start, end, isClosed=False):
points = []
for i in range(start, end+1):
point = [landmarks.part(i).x, landmarks.part(i).y]
points.append(point)
points = np.array(points, dtype=np.int32)
cv2.polylines(im, [points], isClosed, (255, 200, 0), thickness=2, lineType=cv2.LINE_8)
# Use this function for 68-points facial landmark detector model
@rajathithan
rajathithan / gcpiamuserlist-extraction.sh
Last active July 17, 2024 12:54
Script to retrieve GCP IAM roles, users and serviceaccounts
#!/bin/bash
# Script to retrieve GCP IAM roles, users and serviceaccounts
# Author - Rajathithan Rajasekar - 03/03/2020
# Update - 07/12/2023
gcloud config set accessibility/screen_reader False
echo 'project-name,roles/rolename,user:username-and-serviceaccounts' > iamlist.csv
prjs=( $(gcloud projects list | tail -n +2 | awk {'print $1'}) )
for i in "${prjs[@]}"
do
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"