Skip to content

Instantly share code, notes, and snippets.

View harish2704's full-sized avatar

Harish Karumuthil harish2704

View GitHub Profile
@harish2704
harish2704 / gdrive_dl.sh
Created April 13, 2020 13:02
Download publicly accessible files from google drive using curl
#!/usr/bin/env bash
urlBase='https://drive.google.com'
fCookie=tmpcookies
curl="curl -L -b $fCookie -c $fCookie"
confirm(){
$curl "$1" | grep jfk-button-action | sed -e 's/.*jfk-button-action" href="\(\S*\)".*/\1/' -e 's/\&/\&/g'
}
@harish2704
harish2704 / gen-knex-migration.ejs
Created February 5, 2020 13:01
Create knex.js migration for existing database. Input Database structure in the form of create table SQL statements, and this ejs template can create Knex.js migration
<%
const Parser = require('sql-ddl-to-json-schema');
const fs = require('fs');
const [ sqlFileName ] = argv;
if( !sqlFileName ) throw new Error('SQL file not specified');
const parser = new Parser('mysql');
parser.feed( fs.readFileSync( sqlFileName, 'utf-8'));
const data = parser.toCompactJson();
@harish2704
harish2704 / README.md
Last active November 8, 2023 11:09
A dummy express server which will dump headers , url , method & body of the request

express-dummy-server

@harish2704
harish2704 / new-bash-session
Created January 18, 2020 13:44
Create a new bash session and save/load all the command history in current directory
#!/usr/bin/env bash
export HISTFILE=$PWD/.bash_history
bash
@harish2704
harish2704 / gen-cert.sh
Last active January 11, 2023 10:45
Generate ROOT CA and self signed certificates from localhost
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "Usage: gen-cert.sh <maindomain> [coma separated list of other domains]"
exit 1
fi
DomainName="$1";
moreDomains="$2";
@harish2704
harish2704 / CUDA-Tesla-p100-Colab.txt
Last active December 30, 2019 17:56
ROCm vs CUDA performance comparison based on training of image_ocr example from Keras
```
python3 examples/image_ocr.py
Using TensorFlow backend.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:541: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4479: The name tf.truncated_normal is deprecated. Please use tf.random.truncated_normal instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4267: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py:4432: The name tf.random_uniform is deprecated. Please use tf.random.uniform instead.
@harish2704
harish2704 / myutils.sh
Last active April 3, 2020 18:35
My utils
#!/usr/bin/env bash
fonts_for_lang(){
fc-list :lang=$1
}
sshInTabs(){
logins="$@"
for i in $logins; do
@harish2704
harish2704 / capacitance.ipynb
Last active July 8, 2019 21:43
capacitance.ipdb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harish2704
harish2704 / snmp_count_process.sh
Created December 28, 2018 20:36
Count number of process matching given process name and arguments using snmp protocol
#!/bin/bash
listProcessNameMib=.1.3.6.1.2.1.25.4.2.1.2
listProcessArgsMib=.1.3.6.1.2.1.25.4.2.1.5
snmpHost=$1
snmpCommunity=$2
shift
shift
processName=$@
@harish2704
harish2704 / zypper_dup_print_urls.py
Created October 1, 2018 18:17
parallel downloads while doing zypper distribution upgrade
#!/usr/bin/env python2
"""
This script will print package urls which need to be downloaded for 'distrubution upgrade'
Printed urls can be used for downloading packages in parallel.
For eg: we can use GNU parallel commanline tool along with wget/curl for parallel downloading
python2 zypper_dup_print_urls.py | parallel --tmuxpane -j4 --colsep ' ' mkdir -p '{1}/{2}' \; cd '{1}/{2}' \; wget -c {3}
will download packages with 4 simultaneous downloads
"""