Skip to content

Instantly share code, notes, and snippets.

View webbedfeet's full-sized avatar

Abhijit Dasgupta webbedfeet

View GitHub Profile
@webbedfeet
webbedfeet / common-sci-symbols.md
Created April 11, 2017 18:25 — forked from benmarwick/common-sci-symbols.md
Commonly used scientific symbols in pandoc markdown

Commonly used scientific symbols in pandoc markdown

encoding is UTF-8, needs pdflatex

per mille sign

  • plain text: ‰ (doesn't render properly in PDF)
  • HTML: ‰ (renders properly in PDF)
  • LaTeX: $\text{\textperthousand}$ (renders properly in PDF)

delta sign

@webbedfeet
webbedfeet / tar_h5.py
Created October 11, 2023 20:16
Selectively adding files to a tar using Python glob
from pathlib import Path
import tarfile
with tarfile.open('data.tar','w') as tar:
for name in Path('.').glob('*/filtered_feature_bc_matrix.h5'):
tar.add(name)
syntax on
filetype plugin indent on
set number
set path+=**
set noswapfile
set undofile
set incsearch
set smartindent
set ic
set expandtab
@webbedfeet
webbedfeet / df_diff.py
Created August 29, 2022 04:33
Set difference of rows of two data frames
def df_diff(d1, d2):
"""
df_diff Create a DataFrame containing rows of d1 not in d2
Arguments:
d1 -- A data frame
d2 -- Another DataFrame which is a subset of d1
Returns:
A pandas DataFrame containing rows of d1 that are not in d2
@webbedfeet
webbedfeet / Makefile
Created July 10, 2022 17:40 — forked from gernotstarke/Makefile
Makefile for authoring markdown with a (BibTeX-based) citation manager like Zotero
# For a description of this file, please see:
# https://www.innoq.com/en/blog/markdown-with-zotero-workflow
#------------------------------------------------------------
# what's the name of the generated output file(s)
OUTPUT=out
# what's the name of the markdown source file
SOURCE=principles-content.md
@webbedfeet
webbedfeet / dailyNoteTemplate.txt
Created May 23, 2022 19:27 — forked from bennewton999/dailyNoteTemplate.txt
My current Daily Note Template in Obsidian utilizing Templater and DataView Plugins
---
creation date: <% tp.file.creation_date() %>
tags: DailyNote <% tp.file.title.split('-')[0] %>
---
modification date: <%+ tp.file.last_modified_date("dddd Do MMMM YYYY HH:mm:ss") %> // This doesn't currently work in front matter, hoping that gets fixed.
# <% tp.file.title %>
<< [[<% tp.date.now("YYYY-MM-DD", -1, tp.file.title, "YYYY-MM-DD") %>]] | [[<% tp.date.now("YYYY-MM-DD", 1, tp.file.title, "YYYY-MM-DD") %>]]>>
@webbedfeet
webbedfeet / MungingFWF.ipynb
Last active September 30, 2021 19:49
Munging fixed width format
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@webbedfeet
webbedfeet / testdash.Rmd
Last active December 11, 2020 06:10
Including python-based graphics in flexdashboard
---
title: "Example dashboard"
output:
flexdashboard::flex_dashboard:
orientation: columns
vertical_layout: scroll
html_document: default
---
```{r setup, include=FALSE}
@webbedfeet
webbedfeet / coronaDeaths.R
Created March 21, 2020 20:06
Code to create COVID-19 attributed death trajectories by country using JHU data
# remotes::install_github('ramikrispin/coronavirus')
library(coronavirus)
update_datasets()
pacman::p_load(char=c('tidyverse','janitor', 'ggrepel'))
deaths <- coronavirus %>%
clean_names() %>%
filter(type=='death') %>%
group_by(country_region, date) %>%
summarise(cases = sum(cases)) %>%
@webbedfeet
webbedfeet / lowpass.py
Created November 22, 2019 05:14 — forked from junzis/lowpass.py
Python Lowpass Filter
# https://stackoverflow.com/questions/25191620/
# creating-lowpass-filter-in-scipy-understanding-methods-and-units
import numpy as np
from scipy.signal import butter, lfilter, freqz
from matplotlib import pyplot as plt
def butter_lowpass(cutoff, fs, order=5):
nyq = 0.5 * fs