Skip to content

Instantly share code, notes, and snippets.

View Thell's full-sized avatar

Thell 'Bo' Fowler Thell

  • Pyrapat Inc.
  • Arkansas, USA
View GitHub Profile
@Thell
Thell / sample.Rmd
Created October 24, 2012 22:57
SO-Answer-download-revise-upload-github-gists-with-r
This is a simple public sample.
---
It really should do more.
// [[Rcpp::plugins(cpp11)]]
#include <Rcpp.h>
using namespace Rcpp;
// Rcpp containers
typedef Rcpp::NumericMatrix nm;
typedef Rcpp::NumericVector nv;
typedef Rcpp::IntegerMatrix im;
typedef Rcpp::IntegerVector iv;
typedef Rcpp::LogicalMatrix lm;
@Thell
Thell / Exmple.Rmd
Created June 20, 2013 23:59
R markdown to illustrate creation of in-document referencing for chunks, sections, pages, and such.
```{r setup, echo=FALSE, results='hide'}
chunkref <- local({
function(chunklabel) {
sprintf('[%s](#%s)', chunklabel, chunklabel )
}
})
secref <- local({
function(seclabel) {
sprintf('[%s](#%s)', seclabel, seclabel )
@Thell
Thell / gist:8324791
Created January 8, 2014 21:14
Possible Wrapper to skip the last n lines of R read.csv
myread.csv <- function( file, header=TRUE, sep=",", quote="\"", dec=".", fill=TRUE, comment.char="", skip.footer=0, ... ) {
file <- readLines(file)
if( skip.footer > 0 ) file <- file[-(skip.footer)]
read.csv( file, header, sep, quote, dec, fill, comment.char, ... )
}
---
title: "SO22524822"
author: "Thell"
date: "03/21/2014"
output: html_document
---
```{r setup}
# A killPrefix hook.
default_output_hook <- knitr::knit_hooks$get("output")
@Thell
Thell / example.pq
Last active February 7, 2021 08:38
An example of unpivoting multiple columns.
let
Source = Table.FromRows(
Json.Document(
Binary.Decompress(
Binary.FromText(
"bcxBCoAgFATQq8hf28L5p+gM4iLJoE1FtLDbl4INhLth/rzvvYzbnLJYOc60rNlc95Gc8cu+u9Br0W3116L7AW0brBf33iZTVsMXwag1Rg5iawsGMYhBDGIQo2IlVmIlVmIlVgnhAQ==",
BinaryEncoding.Base64
),
Compression.Deflate
)
@Thell
Thell / rcpp_vs_rust_zeros.R
Created December 20, 2021 22:30
Benchmarking returning zero filled rcpp vs rextendr vector and matrix.
# compare rcpp and rust zero matrices performance to test wrap times.
library(microbenchmark)
Rcpp::sourceCpp(
code = '
#include <Rcpp.h>
using namespace Rcpp;
@Thell
Thell / apt-fast-progress.sh
Last active March 19, 2022 19:16
Aria2 rpc based progress monitor for apt-fast in non-interactive shells.
#!/bin/sh
# Aria2 rpc based progress output for apt-fast
# trigger using --on-download-complete callback.
# Provide bytesNeeded in the parent environment...
# apturis=$(apt-get -qq --print-uris "$@")
# export DLLISTBYTES=$( echo "$apturis"| awk -F " " '{bytes+=$3} END{print bytes}' )
aria2_rpc () {
@Thell
Thell / Basic-RStudio-WSL2-Install.md
Last active May 21, 2022 17:19
A very basic, no-frills, setup of RStudio on WSL2.

VERY Basic WSL2 RStudio Install

Begin with a plain Ubuntu distro from the Windows App Store. If one is already installed and you want to start from scratch simply:

wsl -t Ubuntu
wsl --unregister Ubuntu
Ubuntu
@Thell
Thell / main.rs
Last active June 14, 2022 23:10
wip - beginner clap definitions
use clap::{Args, ArgGroup, Parser, Subcommand};
#[derive(Parser)]
#[clap(author, version, about, long_about = None)]
#[clap(propagate_version = true)]
struct Cli {
#[clap(subcommand)]
command: Commands,
}