Skip to content

Instantly share code, notes, and snippets.

View tshrinivasan's full-sized avatar

Shrinivasan T tshrinivasan

View GitHub Profile
@tshrinivasan
tshrinivasan / create-aws-ecr-authentication-cronjob.md
Last active October 21, 2021 15:51 — forked from tuantranf/create-aws-ecr-authentication-cronjob.md
A Kubernetes cronjob to refresh ECR authentication

A Kubernetes cronjob to refresh ECR authentication

Create AWS secret

kubectl create secret generic aws-secret --from-literal=AWS_ACCOUNT= --from-literal=AWS_ACCESS_KEY_ID= --from-literal=AWS_SECRET_ACCESS_KEY= --from-literal=AWS_DEFAULT_REGION= --from-literal=AWS_REGION=

Create cronjob

@tshrinivasan
tshrinivasan / compare_images.py
Created February 9, 2021 21:24
compare images in python
import cv2
import numpy as np
def mse(imageA, imageB):
err = np.sum((imageA.astype("float") - imageB.astype("float")) ** 2)
err/=float(imageA.shape[0] * imageA.shape[1])
return err
original_testfigure1 = cv2.imread("testfigure1.png")
expected_testfigure1 = cv2.imread("testfigure2.png")
@tshrinivasan
tshrinivasan / mass_find_replace.py
Last active December 10, 2020 08:08
python script to replace multiple strings from a given csv file
# sample content of replace_dictionary.csv
#gooood, god
#baaaad, bad
#coool, cool
#
replace_dict = {}
#!/usr/bin/env python3
# Author: T Shrinivasan
# Email : [email protected]
# License : GNU GPL 3.0
# sudo apt install libimage-exiftool-perl imagemagick gwenview
# /etc/ImageMagick-6/policy.xml
@tshrinivasan
tshrinivasan / make_unique_words.py
Created May 25, 2020 17:17
make unique tamil words from any given big file
import sys
import re
import tamil
infile = sys.argv[1]
spechal_charecers = ["~","`","!","@","#","$","%","^","&","*","(",")","_","-","+","=","[","{","]","}",'\\',"|",";",":","\'",'\"',"<",">",".","?","/",',',"’","\’",'“','”']
numbers = [1,2,3,4,5,6,7,8,9,0]
sandhi_chars = ['க்','ச்', 'த்', 'ப்']
@tshrinivasan
tshrinivasan / tess_ocr_pdf.py
Created May 23, 2020 16:36
Convert a PDF file to text using Tesseract OCR
import os
import sys
import glob
#import telegram_send
all_pdf = glob.glob("*.pdf")
all_pdf_count = len(all_pdf)
@tshrinivasan
tshrinivasan / fix_records.py
Created November 22, 2019 07:39
A program to find and replace bibliographical data
# program name : fix_records.py
# author : [email protected]
# version : 0.1
import sys
import os
import argparse
parser = argparse.ArgumentParser(description='A program to find and replace bibliographical data')
@tshrinivasan
tshrinivasan / parse-voter-list.py
Created October 3, 2019 12:49
Code to parse voter list pdf - ocred by tesseract
import sys
in_file = sys.argv[1]
content = open(in_file).read()
out = open("result.csv","a")
con = content.split("வாக்காளர்‌ பெயர்‌")
@tshrinivasan
tshrinivasan / OverPassToGoogleSheet.gs
Created May 26, 2019 09:54
OverPassToGoogleSheet.gs
//var langCode ='ta'; -- TODO Make it language independent.
function doGet() {
return HtmlService.createTemplateFromFile('Index.html')
.evaluate();
}
function doSomething() {
Logger.log('I was called!');
}
@tshrinivasan
tshrinivasan / remove_strings_from_files.py
Created March 31, 2019 11:00
#This program helps to remove the given words in a file to all the files inside a directory, recursively. # Got the sed idea from http://www.linuxask.com/questions/replace-multiple-strings-using-sed
#This program helps to remove the given words in a file to all the files inside a directory, recursively.
# Got the sed idea from http://www.linuxask.com/questions/replace-multiple-strings-using-sed
import sys
import glob
import os
import argparse
parser = argparse.ArgumentParser()