Skip to content

Instantly share code, notes, and snippets.

View jeroenjanssens's full-sized avatar

Jeroen Janssens jeroenjanssens

View GitHub Profile
decompose <- function(expr) {
expr <- substitute(expr)
funs <- setdiff(all.names(expr), all.vars(expr))
wrapped <- list()
for (fun in funs) {
fun_env <- environment(get(fun, envir = parent.frame()))
if(is.null(fun_env))
namespace <- "base"
else
namespace <- getNamespaceName(fun_env)
#!/usr/bin/awk -f
# This program is a copy of guff, a plot device. https://github.com/silentbicycle/guff
# My copy here is written in awk instead of C, has no compelling benefit.
# Public domain. @thingskatedid
# Run as awk -v x=xyz ... or env variables for stuff?
# Assumptions: the data is evenly spaced along the x-axis
# TODO: moving average
@tatianamac
tatianamac / tatiana-mac-speaker-rider.md
Last active March 24, 2024 12:22
Tatiana Mac's Speaker Rider

Speaker Rider

by Tatiana Mac

Last updated 14 April 2021

What is a speaker rider?

As speaking comes with immense privilege, I have crafted a speaker rider to set expectations and boundaries around my engagement. I am grateful to all the conference organisers who have brilliantly hosted me. I would love to continue to exercise this privilege to speak at conferences, and use this privilege to make the landscape more accessible and beneficial to tech's most historically excluded and marginalised communities.

Considerations

😫 I provide a lot of explanations for those of you who never had to consider these things. Most thoughtful conferences I've attended check most of these boxes intrinsically, particularly when conference runners are experienced speakers. They get it.

@hexerei
hexerei / index.html
Created May 26, 2017 10:16
Liquid number format with thousands and decimal seperator
<h1>Usage Template</h1>
<h2>With integer to decimal conversion</h2>
<p>
{% include numf.html number=12345 %} <!-- output is 12.345,00 --><br />
{% include numf.html number=12345 decimals=0 %} <!-- output is 12.345 --><br />
{% include numf.html number=12345 decimals=4 %} <!-- output is 12.345.0000 --><br />
{% include numf.html number=12345 ds='.' ts=',' %} <!-- output is 12,345.00 --><br />
</p>
@jeroenjanssens
jeroenjanssens / case-citibikes.sh
Last active August 29, 2015 14:07
Data Science at the Command Line Strata Tutorial
# make sure that you have the R package `ggmap` installed
curl -s http://api.citybik.es/citi-bike-nyc.json > citibikes.json
< citibikes.json jq -r '.[] | [.lat/1000000,.lng/1000000,.bikes] | @csv' | header -a lat,lng,bikes > citibikes.csv
< citibikes.csv Rio -vge 'require(ggmap); qmap("NYC", zoom=14) + geom_point(data=df, aes(x=lng, y=lat, size=bikes))' > citibikes.png
@alienfluid
alienfluid / topnwords.R
Created April 25, 2014 14:22
topnwords.R
#!/usr/bin/env Rscript
library(tm)
num.words <- as.integer(commandArgs(trailingOnly = TRUE))
f <- file("stdin")
input.lines <- readLines(f)
close(f)
full.text <- tolower(paste(input.lines, collapse = " "))
freqs <- sort(termFreq(PlainTextDocument(full.text), control=list(wordLengths= c(1,Inf))), decreasing=T)[1:num.words]
for (i in 1:num.words) {
cat(freqs[i], names(freqs)[i], "\n", sep=' ')
@jeroenjanssens
jeroenjanssens / chat.sh
Last active February 15, 2022 21:44
Simple chat server in bash, demonstrating websocketd.
#!/bin/bash
# Hacked together by JeroenJanssens.com on 2013-12-10
# Requires: https://github.com/joewalnes/websocketd
# Run: websocketd --devconsole --port 8080 ./chat.sh
echo "Please enter your name:"; read USER
echo "[$(date)] ${USER} joined the chat" >> chat.log
echo "[$(date)] Welcome to the chat ${USER}!"
tail -n 0 -f chat.log --pid=$$ | grep --line-buffered -v "] ${USER}>" &
while read MSG; do echo "[$(date)] ${USER}> ${MSG}" >> chat.log; done
@jhofman
jhofman / scrapple.py
Last active December 24, 2015 08:49
checks apple.come for iphone 5s in-store pickup availability
#!/usr/bin/env python
#
# file: scrapple.py
#
# description: checks apple.come for iphone 5s in-store pickup availability
#
# usage: ./scrapple.py [zip] [att|verizon|sprint] [16|32|64] [grey|silver|gold]
#
# or in a crontab:
# */5 * * * * /path/to/scrapple.py 10012 verizon 32 grey && mailx -s 5s 2125551212@vtext.com