Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Prathyush SP kingspp

🎯
Focusing
View GitHub Profile
@kingspp
kingspp / overleaf_compile_on_focus.js
Created Jun 10, 2022
Compile document on window focus
View overleaf_compile_on_focus.js
// Run below code in respective window console
window.addEventListener("focus", e => document.getElementsByClassName("btn-recompile")[0].click());
@kingspp
kingspp / convert_bash_alias_to_scripts.sh
Created May 26, 2020
Convert Bash Aliases to bash scripts for support for fish executables
View convert_bash_alias_to_scripts.sh
#!/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 — forked from masih/fish_shell_local_install.sh
Installs Fish Shell without root access
View fish_shell_local_install.sh
#!/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
Pure JS Implementation to get total number of github commits
View purejs_github_commits.js
// 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 Sep 12, 2021
Tee functionality replicated for python - Simultaneously `print` to a file and `std out`
View Tee.py
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 Apr 8, 2020
Showcases custom metric (Confusion Matrix) implementation in Tensorflow
View confusion_matrix_tensorboard.py
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 Mar 15, 2020
Collection of algorithms in pure python
View pure_python_algos.py
# 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 Sep 12, 2021
Custom Json Encoder for json.dump()
View JsonEncoder.py
# -*- coding: utf-8 -*-
"""
| **@created on:** 18/07/18,
| **@author:** prathyushsp,
| **@version:** v0.0.1
|
| **Description:**
|
|
| **Sphinx Documentation Status:** --
@kingspp
kingspp / pandas2spark.md
Last active Oct 5, 2019
Pandas Transformations in Spark
View pandas2spark.md

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

@kingspp
kingspp / rpi_config.sh
Created Apr 12, 2019
Raspberry Pi Configuration
View rpi_config.sh
#!/bin/bash
# Install required softwares
sudo apt-get update
sudo apt-get install fish -y
sudo chsh -s /usr/bin/fish
# Setup static IP -
# LAN - 192.168.0.99
# WLAN - 192.168.0.199