Skip to content

Instantly share code, notes, and snippets.

View nfultz's full-sized avatar
🌯

Neal Fultz nfultz

🌯
View GitHub Profile
set.seed(1)
matches <- replicate(1000000, sample(20, sample(20), TRUE))
fun1 <- function() unlist(lapply(matches, sum))
fun2 <- function() sapply(matches, sum)
fun3 <- function() vapply(matches, sum, numeric(1L))
fun4 <- function() rapply(matches, sum)
library(microbenchmark)
microbenchmark(L = fun1(), S = fun2(), V = fun3(), R = fun4(), times = 10)
# Unit: seconds
# expr min lq mean median uq max neval
;;; repl.sh
#!/bin/bash
if [[ "$#" -ne 1 ]]; then
echo "Usage: repl.sh 'script to be run'"
exit 1
fi
screen -AdmS 'main' "$1"
@romainl
romainl / deprecation.md
Last active February 24, 2022 02:42
Idiomatic vimrc
@david-christiansen
david-christiansen / FizzBuzzC.idr
Last active August 29, 2022 20:00
Dependently typed FizzBuzz, now with 30% more constructive thinking
module FizzBuzzC
%default total
-- Dependently typed FizzBuzz, constructively
-- A number is fizzy if it is evenly divisible by 3
data Fizzy : Nat -> Type where
ZeroFizzy : Fizzy 0
Fizz : Fizzy n -> Fizzy (3 + n)
@jennybc
jennybc / 2014-07-18_lazy-evaluation-hangnail.md
Last active October 26, 2017 18:04
What R's lazy evaluation does and does not imply

Lazy evaluation hang nail

Jenny Bryan
18 July, 2014

A group of us at UBC are working through Wickham's Advanced R Programming book together. We just tackled the chapter on Functions, which reminded me of this ...

In the subsection on "Default and missing arguments", we have: "Since arguments in R are evaluated lazily (more on that below), the default value can be defined in terms of other arguments:"

@jsomers
jsomers / websters-kindle.mdown
Created May 19, 2014 01:42
How to make the Webster's 1913 your default Kindle dictionary

How to make the Webster's 1913 your default Kindle dictionary

  1. Download a Kindle-compatible version of the dictionary here. Unzip the .rar archive.

  2. Get the "Send to Kindle" program on your computer. Here's the link for the Mac.

  3. Right-click your recently downloaded (unzipped) dictionary file, and click the "Send to Kindle" menu item. It will arrive on your Kindle shortly.

  4. Once the dictionary has arrived, go to your settings -- on my newish paperwhite, it's at Home > Settings > Device Options > Language and Dictionaries > Dictionaries > English. Choose the Webster's 1913.

@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 14, 2025 04:34
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@lbruder
lbruder / lbForth.c
Created April 6, 2014 15:21
A minimal Forth compiler in ANSI C
/*******************************************************************************
*
* A minimal Forth compiler in C
* By Leif Bruder <leifbruder@gmail.com> http://defineanswer42.wordpress.com
* Release 2014-04-04
*
* Based on Richard W.M. Jones' excellent Jonesforth sources/tutorial
*
* PUBLIC DOMAIN
*
@simonmichael
simonmichael / accounts.txt
Last active May 30, 2023 09:43
a sample *ledger chart of accounts (first 3 levels): combined personal & business, eg for a freelancer
assets
business
accounts receivable
bank
personal
accounts receivable
bank
cash
gifts
online
#!/usr/bin/python
# -*- coding: utf-8 -*-
import subprocess
__all__ = ["transform"]
__version__ = '0.3'
__author__ = 'Christoph Burgmer <[email protected]>'
__url__ = 'http://github.com/cburgmer/upsidedown'