Skip to content

Instantly share code, notes, and snippets.

View laasousa's full-sized avatar

Luís Alves de Sousa laasousa

View GitHub Profile
@laasousa
laasousa / data.table-joins.R
Created March 23, 2022 13:54 — forked from nacnudus/data.table-joins.R
How to do joins with data.table
library(data.table)
?`[.data.table`
DT <- data.table(x=rep(c("b","a","c"),each=3), y=c(1,3,6), v=1:9)
X <- data.table(x=c("c","b"), v=8:7, foo=c(4,2))
colnames(DT)
# [1] "x" "y" "v"

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@laasousa
laasousa / fowler.md
Created December 1, 2020 10:31 — forked from danilobatistaqueiroz/fowler.md
Notes from Martin Fowler's "Refactoring"

Refactoring, Fowler

http://martinfowler.com/books/refactoring.html

Five or six years ago I was working on an essay about refactoring CSS. I didn't do that, but I did find these notes while working on something new. Hope they're useful! —Dean

p7 "When you find you have to add a feature to a program, and the program's code is not structured in a convenient way to add the feature, first refactor the program to make it easy to add the feature, then add the feature."

p7

@laasousa
laasousa / gp-regression-demo.r
Created December 1, 2020 10:27 — forked from jkeirstead/gp-regression-demo.r
Demo of Gaussian process regression with R
# Demo of Gaussian process regression with R
# James Keirstead
# 5 April 2012
# Chapter 2 of Rasmussen and Williams's book `Gaussian Processes
# for Machine Learning' provides a detailed explanation of the
# math for Gaussian process regression. It doesn't provide
# much in the way of code though. This Gist is a brief demo
# of the basic elements of Gaussian process regression, as
# described on pages 13 to 16.
@laasousa
laasousa / .emacs
Created June 1, 2020 15:22 — forked from benmarwick/.emacs
Notes on using Emacs
;;Record startup timestamp
(defvar Emacs/invokation-time
(current-time))
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(custom-enabled-themes (quote (tango-plus)))
@laasousa
laasousa / emacs26.sh
Created May 26, 2020 19:03 — forked from kissge/emacs26.sh
Compile Emacs 26 on Ubuntu 16.04 on Windows Subsystem for Linux (WSL, aka Bash on Ubuntu on Windows)
mkdir emacs
cd emacs
git init
git remote add origin https://github.com/emacs-mirror/emacs.git
git fetch --depth 1 origin emacs-26
git reset --hard FETCH_HEAD
sudo apt install autoconf make gcc texinfo libgtk-3-dev libxpm-dev libjpeg-dev libgif-dev libtiff5-dev libgnutls-dev libncurses5-dev
./configure
make
sudo make install
---
title: "50 von 100,000 Notbremse innherhalb von 7 Tagen"
author: "Michael Höhle ([https://www.math.su.se/~hoehle](https://www.math.su.se/~hoehle))"
date: "`r Sys.Date()`"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
# Lade Pakete
@laasousa
laasousa / cl-jags.R
Created April 23, 2020 18:44 — forked from chrishanretty/cl-jags.R
Conditional logit in R + JAGS
## Load libraries
library(mclogit)
library(reshape)
library(rjags)
library(R2WinBUGS) ## for write.model
## Load the data file from mclogit
data(Transport)
## Do the mclogit model