Skip to content

Instantly share code, notes, and snippets.

View kingspp's full-sized avatar
🎯
Focusing

Prathyush SP kingspp

🎯
Focusing
View GitHub Profile
@kingspp
kingspp / us_rmv_appointment_finder.py
Last active October 13, 2023 01:21
Search and locate latest appointments for RMV. Needs Python v3.5+. Tested on Mac and Linux Environments
# %% [markdown]
# RMV Appointment Finder v1.0
# %%
# Install Required Libraries
# !python3 -m pip install selenium pandas tqdm webdriver-manager -q
#
# Execution:
# python3 us_rmv_appointment_finder.py
#
@kingspp
kingspp / overleaf_compile_on_focus.js
Last active July 21, 2023 01:26
Compile document on window focus
// Run below code in respective window console
window.addEventListener("focus", e => document.getElementsByClassName("split-menu-button")[0].click());
@kingspp
kingspp / convert_bash_alias_to_scripts.sh
Created May 26, 2020 14:51
Convert Bash Aliases to bash scripts for support for fish executables
#!/bin/bash
# Convert bash aliases to bash scripts.
#
# Copyright 2018 <hoijui.quaero@gmail.com>, licensed under the GPL-3.0+
#
# Usage:
# convert_bash_aliases_to_scripts # converts all bash aliases to script files
# convert_bash_aliases_to_scripts clean # removes all scripts previously converted by this script
COLOR_RED=$'\e[0;31m'
@kingspp
kingspp / fish_shell_local_install.sh
Last active May 8, 2020 14:30 — forked from masih/fish_shell_local_install.sh
Installs Fish Shell without root access
#!/bin/bash
# Script for installing Fish Shell on systems without root access.
# Fish Shell will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
FISH_SHELL_VERSION=3.1.2
@kingspp
kingspp / purejs_github_commits.js
Created May 1, 2020 18:15
Pure JS Implementation to get total number of github commits
// Credits - https://gist.github.com/yershalom/a7c08f9441d1aadb13777bce4c7cdc3b
const base_url = 'https://api.github.com';
function httpGet(theUrl, return_headers) {
var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", theUrl, false); // false for synchronous request
xmlHttp.send(null);
if (return_headers) {
return xmlHttp
@kingspp
kingspp / Tee.py
Last active September 12, 2021 00:29
Tee functionality replicated for python - Simultaneously `print` to a file and `std out`
import traceback
import sys
# Context manager that copies stdout and any exceptions to a log file
class Tee(object):
def __init__(self, filename):
self.file = open(filename, 'w')
self.stdout = sys.stdout
def __enter__(self):
@kingspp
kingspp / confusion_matrix_tensorboard.py
Last active April 8, 2020 15:46
Showcases custom metric (Confusion Matrix) implementation in Tensorflow
import typing
import matplotlib.pyplot as plt
import tensorflow as tf
def plot_confusion_matrix(cm: np.array, label_mappings:typing.Dict, num_classes:int) -> plt.Figure:
"""
| **@author:** Prathyush SP
|
| Create a confusion matrix using matplotlib
:param cm: A confusion matrix: A square ```numpy array``` of the same size as labels
@kingspp
kingspp / pure_python_algos.py
Last active March 15, 2020 00:22
Collection of algorithms in pure python
# Argsort
l = [1,8,3,10,13, 23,4]
# Ascending
args = sorted(range(len(l)), key=l.__getitem__)
#[0, 2, 6, 1, 3, 4, 5]
# Descending
args[::-1]
#[5, 4, 3, 1, 6, 2, 0]
@kingspp
kingspp / JsonEncoder.py
Last active September 12, 2021 00:29
Custom Json Encoder for json.dump()
# -*- coding: utf-8 -*-
"""
| **@created on:** 18/07/18,
| **@author:** prathyushsp,
| **@version:** v0.0.1
|
| **Description:**
|
|
| **Sphinx Documentation Status:** --
@kingspp
kingspp / pandas2spark.md
Last active October 5, 2019 15:08
Pandas Transformations in Spark

pandas2spark

This repo demonstrates moving from pandas to spark for big data analysis

Python - v3.5.2
Pandas - v0.19.2
Spark - v2.1.0

Pandas Installation