Skip to content

Instantly share code, notes, and snippets.

View webbedfeet's full-sized avatar

Abhijit Dasgupta webbedfeet

View GitHub Profile
@Aetherinox
Aetherinox / blue_topaz_overrides.css
Last active November 20, 2023 23:48
Obsidian: CSS Override
/* @settings
name: ⚙️ Blue Topaz (Aetherx Extras)
id: blue-topaz-theme-aetherx
settings:
-
id: atx-general
title: 1. General
description: General appearance settings
type: heading
level: 1

App Install Plan

Critical

@gadenbuie
gadenbuie / xaringan-chromote-print.R
Last active November 16, 2023 16:49
Print xaringan slides to PDF, even the complicated ones
#' Print xaringan slides to PDF
#'
#' Prints xaringan slides to a PDF file, even complicated slides
#' with panelsets or other html widgets or advanced features.
#' Requires a local installation of Chrome.
#'
#' @param input Path to Rmd or html file of xaringan slides.
#' @param output_file The name of the output file. If using NULL then
#' the output filename will be based on filename for the input file.
#' If a filename is provided, a path to the output file can also be provided.
@tyrostone
tyrostone / instructions.md
Last active August 16, 2019 03:33
Shiny Server Tutorial

Shiny Server Tutorial Instructions

Prerequisites

  • AWS account is created
  • Non-root user is created
  • VPC exists in the us-east-1 region
    • We can go over the networking of what this should look like

Creating the Host

  1. Log into your AWS account
@lbusett
lbusett / bibtex_2academic.R
Created March 13, 2018 18:56
script for importing publications from a "bibtex" file to a hugo-academic website
#' @title bibtex_2academic
#' @description import publications from a bibtex file to a hugo-academic website
#' @author Lorenzo Busetto, phD (2017) <lbusett@gmail.com>
bibtex_2academic <- function(bibfile,
outfold,
abstract = FALSE,
overwrite = FALSE) {
require(RefManageR)
@gadenbuie
gadenbuie / backstitch.R
Last active August 14, 2019 16:41
Convert Rmd document (knitr::knit) to an R script (knitr::spin) #RMarkdown #knitr #knit #spin
warning("You probably don't want to use this `backstitch()` function.",
"\n It's hacky and there's a much better option in knitr called `purl()`.",
"\n More info at: `?knitr::purl`")
#' Backstitch an Rmd file to an R script
#'
#' Takes an Rmd file -- that would be converted with knitr::knit() -- and
#' "backstitches" it into an R script suitable for knitr::purl(). The output
#' file is the just the backstitched R script when `output_type = 'script'`, or
#' just the code chunks when `output_type = 'code'` (note that all inline code
@ceshine
ceshine / jupyter_notebook_config.py
Created August 23, 2017 12:31
Jupyter Notebook Post-save Hook: Auto-convert a Python script and a HTML from the notebook
# Reference: https://svds.com/jupyter-notebook-best-practices-for-data-science/
import os
from subprocess import check_call
def post_save(model, os_path, contents_manager):
"""post-save hook for converting notebooks to .py scripts"""
if model['type'] != 'notebook':
return # only do this for notebooks
d, fname = os.path.split(os_path)
check_call(['jupyter', 'nbconvert', '--to', 'script', fname], cwd=d)
# data from http://ec.europa.eu/eurostat/web/gisco/geodata/reference-data/population-distribution-demography/geostat
# Originally seen at http://spatial.ly/2014/08/population-lines/
# So, this blew up on both Reddit and Twitter. Two bugs fixed (southern Spain was a mess,
# and some countries where missing -- measure twice, submit once, damnit), and two silly superflous lines removed after
# @hadleywickham pointed that out. Also, switched from geom_segment to geom_line.
# The result of the code below can be seen at http://imgur.com/ob8c8ph
library(tidyverse)
@pokehanai
pokehanai / 30-markdown-mode.el
Created July 22, 2016 09:35
Emacs config for markdown-mode with orgtbl-mode
(use-package markdown-mode
:defer t
:commands (org-table-begin org-table-end orgtbl-mode)
:config
(progn
(require 'org-table)
(eval-when-compile
(require 'whitespace))
(defun advice:org-table-align:markdown ()
@junzis
junzis / lowpass.py
Last active December 6, 2022 08:16
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