Skip to content

Instantly share code, notes, and snippets.

View rgrannell1's full-sized avatar
💻

R*Grannell rgrannell1

💻
View GitHub Profile
data:text/html,%3Chtml%3E%3Chead%3E%3Ctitle%3EJust%20a%20URL%3C%2Ftitle%3E%0A%20%20%0A%20%20%20%20%3Cstyle%3E%0A%20%20%20%20%20%20html%20%7B%0A%20%20%20%20%20%20%20%20font-family%3A%20sans-serif%3B%0A%20%20%20%20%20%20%20%20text-align%3A%20center%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20pre%20%7B%0A%20%20%20%20%20%20%20%20white-space%3A%20pre-line%3B%0A%20%20%20%20%20%20%20%20background-color%3A%20%23002b36%3B%0A%20%20%20%20%20%20%20%20color%3A%20%23fdf6e3%3B%0A%20%20%20%20%20%20%20%20text-align%3A%20left%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%3C%2Fstyle%3E%0A%20%20%3C%2Fhead%3E%0A%0A%20%20%3Cbody%3E%0A%20%20%20%20%3Ch1%3ETodo%3C%2Fh1%3E%0A%0A%20%20%20%20%3Cpre%3E%20%20%20%20%20%20%3Ccode%20id%3D%22url%22%3Edata%3Atext%2Fhtml%2C%253Chtml%253E%253Chead%253E%253Ctitle%253EJust%2520a%2520URL%253C%252Ftitle%253E%250A%2520%2520%250A%2520%2520%2520%2520%253Cstyle%253E%250A%2520%2520%2520%2520%2520%2520html%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520font-family%253A%2520sans-serif%253B%250A
@rgrannell1
rgrannell1 / replit.zsh
Created September 3, 2021 19:46
Live programming repl!
function replit () {
if [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then
echo "
Usage:
replit <lang>
replit <...>
replit (-h|--help)
Description:
Watch for changes in a file, and run a language against the file.

Keybase proof

I hereby claim:

  • I am rgrannell1 on github.
  • I am rgrannell (https://keybase.io/rgrannell) on keybase.
  • I have a public key ASBFTpxRe94Uc3wEHiJDuSLU5By2a6MGYvLlUiZsEB9SnQo

To claim this, I am signing this object:

# Supports the default controls in the way I thought was logical.
#
# A is jump
# B is sneak
# X is drop
# Y is chat
# Scroll with the DPAD
# RT is left click
# LT is right click
# Left joystick is WASD
# this script is poorly-written, so use at your own risk.
# ---------------------------------------------------------------
#
# THIS HAS A VERY GOOD CHANCE OF COMPLETELY DESTROYING YOUR REPO;
# ONLY RUN THIS ON A COPY OF THE REPO!!!
#
# ----------------------------------------------------------------
@rgrannell1
rgrannell1 / gist:8194408
Created December 31, 2013 09:19
get the type signatures and parametres for an r package.
signify <- function (package) {
# environment -> [singatures: [string], params: [string]]
# gets the type-signature of every function in
# an environment, and every unique parameter.
data <- Map(
function (name) {
func <- get(name)
prod <- function (coll) {
# callCC lets you jump out of ANY function early,
# by specifying a breakpoint function (often called 'k').
# if I used return instead of breakpoint here the
# program would take a long time to terminate.
# 1; breakpoint jumps up to this level if it is called, evalulating to zero
callCC(
function (breakpoint) {
@rgrannell1
rgrannell1 / gist:5836273
Created June 22, 2013 07:59
An expression that returns itself by accessing the call stack. Useless but interesting.
(function () {
sys.call()
})()
@rgrannell1
rgrannell1 / forkbomb.r
Created May 30, 2013 17:12
A forkbomb implemented in R for POSIX-compliant operating systems,
forkbomb <- function (...) {
# you probably shouldn't run this; your pc will crash
require (parallel)
parallel::mclapply(1:2, forkbomb, mc.cores = 2)
}
forkbomb()
require(XML)
require(stringr)
raw <- paste0(readHTMLTable('http://www.w3schools.com/tags/')$`NULL`$Tag)
processed <- unname(c(Filter(Negate(is.null),
Map (
function (name) {
if (str_detect(name, '<h1> to')) NULL else str_replace(name, 'New.*$', '')