Skip to content

Instantly share code, notes, and snippets.

View webbedfeet's full-sized avatar

Abhijit Dasgupta webbedfeet

View GitHub Profile
@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
#' ---
#' title: An annotated R script for Homework 6 using lists and maps
#' output: html_document
#' ---
#'
#+, include=FALSE
knitr::opts_chunk$set(error=F, warning=F, message=F)
#' First, read the data in. We've stored just the data files in the folder `data/HW6`.
library(tidyverse)
@webbedfeet
webbedfeet / sqlite2csv.sh
Created September 24, 2019 14:08
Reminder of shell script to convert a table from SQLite to a csv file
#!/user/bin/bash
sqlite3 -header -csv MyDB.sqlite3 "select * from tbl;" > tbl.csv
@webbedfeet
webbedfeet / find_peaks2.R
Created March 21, 2019 20:49
Finding peaks in a signal, based on work by Marcos Duarte (@demotu)
#' Detect peaks in data based on their amplitude and other features
#'
#' Translated from the Python version at https://github.com/demotu/BMC
#' License: MIT
#' Version: 1.0
#'
#' @param x 1-d array
#' @param mph (NA, number), optional (default = NA). Detect peaks wthat are greater than minimum peak height (if `valley=F`) or peaks that are smaller than maximum peak height (if `valley=T`)
#' @param mpd positive integer, optional (default = 1). Detect peaks that are at least separated by minimum peak distance (in number of data)
#' @param threshold positive number, optional (default = 0). Detect peaks (valleys) that are greater (smaller) than `threshold` in relation to their immediate neighbors
@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 / rmspace.sh
Created April 19, 2018 01:30
Replace spaces in filenames/directories recursively
find . -name "* *" -print0 | sort -rz | \
while read -d $'\0' f; do mv -v "$f" "$(dirname "$f")/$(basename "${f// /_}")"; done
@webbedfeet
webbedfeet / conv2docx.sh
Created April 19, 2018 01:05
Converting *.doc into *.docx recursively in a directory structure
for file in $(find . -name "*.doc")
do
/Applications/LibreOffice.app/Contents/MacOS/soffice --convert-to docx $file
done
@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: ‰ (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: ‰ (renders properly in PDF)
  • LaTeX: $\text{\textperthousand}$ (renders properly in PDF)

delta sign