Skip to content

Instantly share code, notes, and snippets.

View k-sriram's full-sized avatar

Sriram Krishna k-sriram

View GitHub Profile
@k-sriram
k-sriram / newpyproject.sh
Last active March 16, 2022 12:22
Quickly initialize a python project
DEV_REQS="black isort flake8 pytest mypy pre-commit"
AUTHOR="Sriram Krishna"
EMAIL="ksri91@gmail.com"
proj=$1
if [ -z "$proj" ]; then
echo "Usage: $0 <project> [<python executable>]"
exit 1
fi
@k-sriram
k-sriram / Periodic Table of Elements.csv
Last active November 16, 2021 09:22 — forked from nullpilot/Periodic Table of Elements.csv
Periodic Table of Elements
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 28 columns, instead of 24. in line 6.
AtomicNumber,Element,Symbol,AtomicMass,NumberOfNeutrons,NumberOfProtons,NumberOfElectrons,Period,Group,Phase,Radioactive,Natural,Metal,Nonmetal,Metalloid,Type,AtomicRadius,Electronegativity,FirstIonization,Density,MeltingPoint,BoilingPoint,NumberOfIsotopes,Discoverer,Year,SpecificHeat,NumberofShells,NumberofValence
1,Hydrogen,H,1.007,0,1,1,1,1,gas,,yes,,yes,,Nonmetal,0.79,2.2,13.5984,8.99E-05,14.175,20.28,3,Cavendish,1766,14.304,1,1
2,Helium,He,4.002,2,2,2,1,18,gas,,yes,,yes,,Noble Gas,0.49,,24.5874,1.79E-04,,4.22,5,Janssen,1868,5.193,1,
3,Lithium,Li,6.941,4,3,3,2,1,solid,,yes,yes,,,Alkali Metal,2.1,0.98,5.3917,5.34E-01,453.85,1615,5,Arfvedson,1817,3.582,2,1
4,Beryllium,Be,9.012,5,4,4,2,2,solid,,yes,yes,,,Alkaline Earth Metal,1.4,1.57,9.3227,1.85E+00,1560.15,2742,6,Vaulquelin,1798,1.825,2,2
5,Boron,B,10.811,6,5,5,2,13,solid,,yes,,,yes,Metalloid,1.2,2.04,8.298,2.34E+00,2573.15,4200,6,Gay-Lussac,1808,1.026,2,3
6,Carbon,C,12.011,6,6,6,2,14,solid,,yes,,yes,,Nonmetal,0.91,2.55,11.2603,2.27E+00,3948.15,4300,7,Prehi
@k-sriram
k-sriram / holiday-IIA-BLR-2021.rc
Last active December 28, 2021 19:02
IIA Bangalore Holidays for taskwarrior
holiday.iia-blr-2021.makarsankranti.name=Makar Sankranti/Pongal
holiday.iia-blr-2021.makarsankranti.date=20210114
holiday.iia-blr-2021.republicday.name=Republic Day
holiday.iia-blr-2021.republicday.date=20210126
holiday.iia-blr-2021.goodfriday.name=Good Friday
holiday.iia-blr-2021.goodfriday.date=20210402
holiday.iia-blr-2021.ugadi.name=Ugadi
holiday.iia-blr-2021.ugadi.date=20210413
holiday.iia-blr-2021.mahavirjayanti.name=Mahavir Jayanti
holiday.iia-blr-2021.mahavirjayanti.date=20210425
@k-sriram
k-sriram / os.zsh
Created November 5, 2021 17:04
ZSH script to determine the OS/Linux distro
# Modified script from https://www.legroom.net/2010/05/05/generic-method-determine-linux-or-unix-distribution-name
# to include the os-release file as well. It might be more consistent, as lsb-release is now an installable package in most systems.
function find-os() {
local UNAME OS
# Determine OS platform
UNAME=$(uname | tr "[:upper:]" "[:lower:]")
# If Linux, try to determine specific distribution
if [[ "$UNAME" == "linux" ]]; then
# First check if os-release is available
if [[ -f /etc/os-release ]]; then
@k-sriram
k-sriram / sleep_history_plot.py
Created October 20, 2021 14:07
Sleep history plot
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import csv
import datetime
from dateutil import parser as dateparser
import numpy as np
from matplotlib import pyplot as plt
import os
import re
@k-sriram
k-sriram / .bashrc
Last active November 5, 2021 19:15
Linux configuration files
#
# ~/.bashrc
#
[ -f "$HOME/.shrc" ] && . $HOME/.shrc
red=31
lightred=91
green=32
lightgreen=92
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# intdistribute.py
# Created by K. Sriram on 2018-10-29
#
# MIT License
#
# Copyright (c) 2018 Sriram Krishna
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
@k-sriram
k-sriram / SHIFT_ADD.rst
Last active December 28, 2018 13:30
Module contains functions to merge two images (represented using multi-dimensional numpy arrays) which may be offset with respect to each other.

shift_add

Module contains functions to merge two images (represented using multi-dimensional numpy arrays) which may be offset with respect to each other.

Contains

  • shift_add
@k-sriram
k-sriram / diffheader.py
Created December 19, 2018 17:33
Code to find the differences in FITS headers and tabulate them in markdown table
from itertools import product
import argparse
import numpy as np
from astropy.io import fits
parser = argparse.ArgumentParser()
parser.add_argument('files',nargs='+')
parser.add_argument('-e','--ext',default='0')
parser.add_argument('-o',default='hdrdiff.md')
args = parser.parse_args()
@k-sriram
k-sriram / 🌟📅.md
Last active January 12, 2019 03:02
Astronom(log)ical information associated with a day, in an attempt to create an astro date format.

Here are the zodiac signs that are active in a month. The second and fourth symbols are those which are present near the equinox or the sidereal zodiac.

Month Zodiac Sidereal
Jan ♑♒ ♐♑
Feb ♒♓ ♑♒
Mar ♓♈ ♒♓
Apr ♈♉ ♓♈
May ♉♊ ♈♉
Jun ♊♋ ♉♊