Skip to content

Instantly share code, notes, and snippets.

View billdenney's full-sized avatar

Bill Denney billdenney

View GitHub Profile
;; Use spaces instead of tabs for indentation
(setq ess-indent-level 2)
(setq-default indent-tabs-mode nil)
(setq ess-default-style 'DEFAULT)
(setq inferior-R-args "--ess --no-save --no-restore-data --arch x64"
ess-indent-level 2
ess-continued-statement-offset 0
ess-eval-visibly nil)
(require 'ess-site)
@billdenney
billdenney / knested_list.R
Last active February 8, 2017 14:24
Generate knitr nested lists in R
#' Convert a nested list structure into a knitr-usable output as html,
#' LaTeX, or markdown (txt).
#'
#' @param x The (nested) list to convert into an output-ready format
#' @param listtype The type of list to generate (may be abbreviated)
#' @param use.names Should the list names be displayed in the output?
#' @param format What output format should be used? The format is
#' auto-detected in knitr output and defaults to "txt" which is
#' markdown text format.
#' @param ... Arguments passed to other methods.
@billdenney
billdenney / rudolph_test.R
Last active November 13, 2019 14:18
Test rudolph with nmtran
if (!requireNamespace("rudolph")) {
devtools::install_github("billdenney/rudolph/r/rudolph")
}
library(rudolph)
nmtrancpp_dir <- "c:/git/Not_my_repositories/nmtranprocessorcpp"
grammar_path <- file.path(nmtrancpp_dir, "grammar/")
compiled_path <- file.path(grammar_path, "rudolph/")
if (!dir.exists(nmtrancpp_dir)) {
dir.create(nmtrancpp_dir, showWarnings=FALSE, recursive=TRUE)
@billdenney
billdenney / wordle.R
Created February 5, 2022 18:51
Solve all words in wordle
# Load all required libraries
library(tidyverse)
# Functions ####
#' Load the possible word lists from the Wordle source
#'
#' @param url The javascript source for finding the word lists
#' @param match_possible_words A word that is within the word list for the
#' possible words (mainly, words that people are likely to know, the Wordle
# This could use some cleanup and robustness changes, but it works for me. Modifications are welcome!
# How to setup a Ubiquiti EdgeRouter POE for FreeRADIUS
# Based on
# https://community.ui.com/questions/FreeRADIUS-on-Edgerouter-2-x/6869cef3-aeca-42c3-9081-e69daa44f397
# https://networkjutsu.com/freeradius-with-two-factor-authentication/
# https://wiki.freeradius.org/guide/Getting-Started
# SSH into your router
@billdenney
billdenney / openssh-2fa-external.sh
Created February 16, 2022 18:36
Setup 2-factor authentication for external connections with openssh
#!/bin/bash
# From https://unix.stackexchange.com/questions/24198/how-to-get-netmask-from-bash
default_if=$(ip route list | awk '/^default/ {print $5}')
local_netmask=$(ip -o -f inet addr show $default_if | awk '{print $4}')
# From https://serverfault.com/questions/518802/two-factor-ssh-authentication-on-external-address-only
printf "# only allow from local IP range\n+ : ALL : ${local_netmask}\n+ : ALL : LOCAL\n- : ALL : ALL\n" > /etc/security/access-local.conf
apt-get install libpam-google-authenticator