In the following, let’s define sum
as
sum = function (a, b, c) a + b +c
Because base::sum
’s definition involves ...
, which would make the following explanation unnecessarily complex.
In the following, let’s define sum
as
sum = function (a, b, c) a + b +c
Because base::sum
’s definition involves ...
, which would make the following explanation unnecessarily complex.
modules::import_package('rlang', attach = TRUE) | |
mutate_when = function (.data, .filter, ...) { | |
dots = dots_definitions(...)$dots | |
rows = eval_tidy(enquo(.filter), .data) | |
.data[rows, names(dots)] = | |
lapply(dots, eval_tidy, data = .data[rows, , drop = FALSE]) | |
.data | |
} |
library(dplyr) | |
library(tidyr) | |
library(ggplot2) | |
stages = c('Ordered', '?', 'In transit', 'Arrived', 'Returned') | |
make_stages = function (status) | |
factor(status, levels = stages, ordered = TRUE) | |
pillows = tibble::tribble( |
#!/usr/bin/env bash | |
while getopts ":n:c:q:" option; do | |
case "$option" in | |
n) | |
cores="$OPTARG" | |
;; | |
m) | |
mem="$OPTARG" | |
;; |
Inspired by a Stack Overflow question, here’s a way of tracking what’s been modifying the .Random.seed
.
Since R makes static analysis impossible in general, the following is a runtime tracer that injects itself into the .Random.seed
variable via an active binding:
debug_random_seed()
sample(10)
#! /usr/bin/env ruby | |
# NOTE: Requires Ruby 2.1 or greater. | |
# This script can be used to parse and dump the information from | |
# the 'html/contact_info.htm' file in a Facebook user data ZIP download. | |
# | |
# It prints all cell phone call + SMS message + MMS records, plus a summary of each. | |
# | |
# It also dumps all of the records into CSV files inside a 'CSV' folder, that is created |
A long time ago, it was possible to inline images from all kinds of external sources. Since the switch from HTTP to HTTPS, this is no longer possible; only HTTPS sources are allowed. This leads to ugly blurbs like
instead of a nicely formatted page with images. Sometimes, the links don't even work anymore, even with HTTPS images, which will show like this: ... Luckily, we have the Wayback Machine which is able to rescue some of the lost images. Since a picture often says more than a thousand words, it's important to bring back the post into its original state; important enough to justify the occasional bump of an old post (see below).
def fib(n: int) -> int: | |
def f(n, a, b): | |
if n == 0: return a | |
if n == 1: return b | |
return f(n - 1, b, a + b) | |
return f(n, 0, 1) |
Andy Thomason is a Senior Programmer at Genomics PLC. He has been witing graphics systems, games and compilers since the '70s and specialises in code performance.
WSL2 uses Hyper-V for networking. The WSL2 network settings are ephemeral and configured on demand when any WSL2 instance is first started in a Windows session. The configuration is reset on each Windows restart and the IP addresses change each time. The Windows host creates a hidden switch named "WSL" and a network adapter named "WSL" (appears as "vEthernet (WSL)" in the "Network Connections" panel). The Ubuntu instance creates a corresponding network interface named "eth0".
Assigning static IP addresses to the network interfaces on the Windows host or the WSL2 Ubuntu instance enables support for the following scenarios: