Skip to content

Instantly share code, notes, and snippets.

View technocrat's full-sized avatar

Richard Careaga technocrat

View GitHub Profile
@technocrat
technocrat / keybase.md
Created June 1, 2023 02:41
Attestation of github ownership

Keybase proof

I hereby claim:

  • I am technocrat on github.
  • I am careaga (https://keybase.io/careaga) on keybase.
  • I have a public key ASDNeDtJHa2iLwfEGS-gnFRc3y4ThLgeA9rrtgybbmvXXwo

To claim this, I am signing this object:

---
title: "Untitled"
author: "Richard Careaga"
date: "2023-05-13"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(ggplot2)
@technocrat
technocrat / tt.md
Created March 24, 2023 03:44
Should TikTok be banned or broken up?

The platform should not be banned on the basis of content because

  1. it not a forum owned by the US government
  2. it is not a forum broadcast over "the public airways" like television and radio that are "affected with the public interest" under the existing scheme of licencing
  3. it is not a forum delivered via a common carrier licensed and regulated under the Commerce Power The platform type may be subject to reasonable time, place and manner regulation as to content and to consumer protection regulation as to terms of service in a manner applicable to similar business

The platform should not be banned up

  1. On the basis of foreign ownership or control without a rationale to distinguish other enterprises operating in the United States also under foreign ownership or control
  2. On the basis of the specific foreign ownership or control that involves no authorization for the imposition of sanctions based on some statutory authority of general applicability that involves specific enumerated conduct such as, for
@technocrat
technocrat / 2023-01-21test.tex
Created January 21, 2023 08:14
Rmd output to tex
% Options for packages loaded elsewhere
\PassOptionsToPackage{unicode}{hyperref}
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[
ignorenonframetext,
]{beamer}
\usepackage{pgfpages}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 123 columns, instead of 33 in line 4.
ID,,CNI1,,CNI2,,CNI3,,CNI4,,CNI5,,CNI6,,CNI7,,CNI8,,CNI9,,CNI10,,CNI11,,CNI12,,CNI13,,CNI14,,CNI15,,CNI16,,ICU1,,ICU2,,ICU3,,ICU4,,ICU5,,ICU6,,ICU7,,ICU8,,ICU9,,ICU10,,ICU11,,ICU12,,ICU13,,ICU14,,ICU15,,ICU16,,ICU17,,ICU18,,ICU19,,ICU20,,ICU21,,ICU22,,ICU23,,ICU24,,BES1,,BES2,,BES3,,BES4,,BES5,,BES6,,BES7,,BES8,,BES9,,BES10,,BES11,,BES12,,BES13,,BES14,,BES15,,BES16,,BES17,,BES18,,BES19,,BES20,,
117099,,1,,4,,2,,4,,7,,2,,5,,5,,4,,7,,2,,2,,3,,6,,4,,4,,2,,2,,2,,1,,2,,1,,1,,4,,1,,2,,1,,3,,2,,1,,2,,3,,4,,2,,1,,1,,1,,2,,3,,3,,5,,3,,1,,5,,5,,4,,4,,3,,1,,1,,1,,2,,1,,1,,5,,1,,4,,5,,5,,5,,
ID117088,,2,,5,,7,,1,,4,,4,,2,,4,,5,,2,,4,,3,,2,,2,,4,,3,,1,,3,,2,,1,,3,,4,,1,,3,,2,,1,,1,,3,,2,,1,,2,,2,,3,,1,,1,,1,,1,,4,,2,,3,,3,,3,,1,,5,,2,,5,,3,,5,,1,,1,,5,,1,,4,,1,,5,,2,,1,,3,,5,,5,,
ID117080,,5,,1,,6,,5,,6,,2,,1,,3,,1,,6,,1,,2,,5,,1,,6,,1,,1,,2,,3,,1,,2,,4,,1,,3,,1,,2,,1,,2,,2,,1,,3,,2,,3,,2,,1,,1,,1,,4,,3,,3,,5,,1,,2,,5,,2,,3,,1,,3,,3,,3,,4,,4,,2,,1,,4,,2,,4,,5,,3,,3,,
I0117098,,4,,4,,3,,6,,7,,4,,3,,6,,6,,7,,1,,5,,5,,5,,7,,
@technocrat
technocrat / input2023-01-19.csv
Created January 19, 2023 08:53
data for reprex
Date Note.Jour Obs.max Stress Sommeil Activite Glissante.10J Glissante.20J Evolution Stress.10J Sommeil.10J Activite.10J Variation.10J
01/01/2022 75 0 2 7,1 17343 NA NA 75 NA NA NA NA
02/01/2022 78 0 4 7,67 10494 NA NA 765 NA NA NA NA
03/01/2022 65 0 6 6,45 9349 NA NA 7266666667 NA NA NA NA
04/01/2022 67 0 4 9,83 6201 NA NA 7125 NA NA NA NA
05/01/2022 77 0 6 7,5 6294 NA NA 724 NA NA NA NA
06/01/2022 7 0 3 8,33 7092 NA NA 72 NA NA NA NA
07/01/2022 72 0 2 6,32 8653 NA NA 72 NA NA NA NA
08/01/2022 83 0 4 9,33 16374 NA NA 73375 NA NA NA NA
09/01/2022 66 0 1 8,17 15055 NA NA 7255555556 NA NA NA NA
@technocrat
technocrat / chrome.md
Created October 1, 2022 08:17
R/RStudio on Chromebook
@technocrat
technocrat / redux.tex
Created August 16, 2022 03:34
Format guide for resume
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This document is based on a template available at
% http://www.LaTeXTemplates.com
%
% Original author:
% Trey Hunner (http://www.treyhunner.com/)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass{resume}
@technocrat
technocrat / make_numeric.html
Created July 4, 2022 07:14
Convert a character vector to numeric, using order of magnitude suffixes, such as 1K
``` r
input <- c("1","3.14","1,000","1K","1k","1,000K","1m","1mm","1.2M","1MM","1b","1.2B")
make_numeric <- function(x){
# check that no other punctuation or suffixes than kKmMbB exist in argument
if(all(grep("[^kKmMbB0-9.,]",x,value = TRUE) == TRUE) == FALSE) stop("Argument contains characters other than numerals, commas, periods and kKmMbB")
# create a receiver object
output = rep(NA,length(x))
# strip commas
x = gsub(",","",x)
``` r
suppressPackageStartupMessages({
library(dplyr)
})
# create synthetic data
set.seed(42)
year_basket <- sample(2000:2020,100, replace = TRUE)
set.seed(137)
fee_basket <- sample(6000:9000,100)