Skip to content

Instantly share code, notes, and snippets.

@simonwmeng
simonwmeng / resetdnscache.sh
Created May 16, 2018 18:12
Flushes the DNS routing table for whenever Tunnelblick gets trapped in a TCP connection loop.
#!/usr/bin/env bash
# Flushes the DNS routing table for whenever Tunnelblick gets trapped in a TCP
# connection loop.
sudo ifconfig en0 down
sleep 5
sudo route -n flush
sleep 5
sudo ifconfig en0 up
@simonwmeng
simonwmeng / kde_scatterplot.R
Last active February 16, 2017 21:46
KDE scatterplot
library(data.table)
library(ggplot2)
library(ks)
# This assumes that you have a data.table, stored in `dt.data`, with columns `x` and `y`.
get.densities <- function (x, y) {
# You can also define your own bandwidth matrix or generate one using Hpi().