Skip to content

Instantly share code, notes, and snippets.

View webbedfeet's full-sized avatar

Abhijit Dasgupta webbedfeet

View GitHub Profile
@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 / 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
@webbedfeet
webbedfeet / analytic_wfm.py
Created June 24, 2018 16:29 — forked from sixtenbe/analytic_wfm.py
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See
@webbedfeet
webbedfeet / sas_export.py
Created June 24, 2017 04:13 — forked from mndrake/sas_export.py
SAS dataset to sqlite wrapper of the sas7bdat python package
#!/usr/bin/python
# Filename: sas_export.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 06 18:40:09 2015
@author: David Carlson
modified version for sas7bdat 2.0.1 of Charlie Huang version at:
http://www.sasanalysis.com/2014/08/python-extension-functions-to-translate.html
"""
@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: &permil; (renders properly in PDF)
  • LaTeX: $\text{\textperthousand}$ (renders properly in PDF)

delta sign

@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: &permil; (renders properly in PDF)
  • LaTeX: $\text{\textperthousand}$ (renders properly in PDF)

delta sign

@webbedfeet
webbedfeet / ggkm.R
Created February 15, 2016 06:39 — forked from araastat/ggkm.R
Plotting a Kaplan-Meier curve using ggplot. ggkmTable.R adds a table below the plot showing numbers at risk at different times.
#’ Create a Kaplan-Meier plot using ggplot2
#’
#’ @param sfit a \code{\link[survival]{survfit}} object
#’ @param returns logical: if \code{TRUE}, return an ggplot object
#’ @param xlabs x-axis label
#’ @param ylabs y-axis label
#’ @param ystratalabs The strata labels. \code{Default = levels(summary(sfit)$strata)}
#’ @param ystrataname The legend name. Default = “Strata”
#’ @param timeby numeric: control the granularity along the time-axis
#’ @param main plot title
library(dplyr)
library(RPostgreSQL)
library(httr)
library(Lahman)
library(ggplot2)
# connect to the db
con <- src_postgres(dbname="harlan", host="localhost", user="harlan")
# upload the Batting db
#source MASTER
setwd("~/your/working/directory") #insert your working directory
#load libraries
library(rgdal)
library(maptools)
library(maps)
library(ggplot2)
library(plyr)
library(grid)