Skip to content

Instantly share code, notes, and snippets.

View jkbest2's full-sized avatar

John Best jkbest2

View GitHub Profile
@sneakers-the-rat
sneakers-the-rat / clean_pdf.sh
Last active February 14, 2024 16:52
Strip PDF Metadata
# --------------------------------------------------------------------
# Recursively find pdfs from the directory given as the first argument,
# otherwise search the current directory.
# Use exiftool and qpdf (both must be installed and locatable on $PATH)
# to strip all top-level metadata from PDFs.
#
# Note - This only removes file-level metadata, not any metadata
# in embedded images, etc.
#
# Code is provided as-is, I take no responsibility for its use,
@mschauer
mschauer / nonparabayes.jl
Last active October 13, 2021 13:07
Non-parametric Bayesian regression in Fourier domain
n = 1000
x = range(0, 1, length=n)
ς = 1.5 # noise level
μ = 3*x.*sin.(2pi*x) # periodic signal in time domain
#μ = 6*sqrt.(abs.(x .- 0.5)) # this one is difficult to estimate
# Model: Signal distorted by white noise
y = μ + ς*randn(n)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mschauer
mschauer / sampler.jl
Created August 12, 2020 14:24
Linear forward filtering backward smoothing/sampling with Zygote
# Linear state space system forward filtering backward sampling with Zygote
using LinearAlgebra
using GaussianDistributions
using GaussianDistributions: ⊕, logpdf
using StaticArrays
using Statistics
using Zygote
@mick001
mick001 / copulas_example.R
Last active April 15, 2023 09:17
Modelling dependence with copulas. Full article at: http://datascienceplus.com/modelling-dependence-with-copulas/
#Load library mass and set seed
library(MASS)
set.seed(100)
# We are going to use 3 random variables
m <- 3
# Number of samples to be drawn
n <- 2000
@gizmaa
gizmaa / Plot_Examples.md
Last active May 8, 2024 13:38
Various Julia plotting examples using PyPlot
@wandernauta
wandernauta / sp
Last active May 14, 2024 16:49
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/usr/bin/env bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
@jkeirstead
jkeirstead / gp-predict.stan
Last active April 18, 2018 01:34
A demo of Gaussian processes using RStan
// Predict from Gaussian Process
// All data parameters must be passed as a list to the Stan call
// Based on original file from https://code.google.com/p/stan/source/browse/src/models/misc/gaussian-process/
data {
int<lower=1> N1;
vector[N1] x1;
vector[N1] y1;
int<lower=1> N2;
vector[N2] x2;