Skip to content

Instantly share code, notes, and snippets.

View DominikVogel's full-sized avatar

Dominik Vogel DominikVogel

View GitHub Profile
@DominikVogel
DominikVogel / hyphenation_hugo_academics.md
Created June 2, 2022 07:44
Enable hyphenation of project title in legacy hugo academic

Problem

Titles of projects look ugly on homepage when words are too long.

Solution

Add HTML soft-hyphen to the title: Digitalization -> Digital­ization.

Adaptation

@DominikVogel
DominikVogel / projektion_groesse_bundestag.R
Created September 27, 2021 12:26
Projektion zur Entwicklung der Größe des Bundestags
library(tidyverse)
func <- function(x){4.25*x*x + 20.45*x + 591.25}
ggplot(data.frame(x=c(1, 22)), aes(x=x)) +
stat_function(fun=func, size = 1.5) +
geom_hline(yintercept = 2980, color = "red", size = 2) +
scale_x_continuous(name = "Jahr",
breaks = c(1:22),
labels = c("2009",
@DominikVogel
DominikVogel / setup_fastai_aws_windows.md
Last active September 17, 2021 15:00
Setup AWS EC2 server for fast.ai and access jupyter notebook from Windows

I found it rather difficult to set up a AWS EC2 server to use fast.ai in a jupyter notebook on it. Especially, since I use a Windows 10 computer (with permanent VPN). I therefore documented the way I used to make it happen. Most of it is just a combination of the fast.ai tutorial, AWS tutorials, and the very helpful tutorial by Baligh Mnassri (https://github.com/mnassrib).

Configure and run instance

Follow steps 1 to 5 detailed here: https://course.fast.ai/start_aws

Setup PuTTY

The SSH connection is realized using PuTTY (https://www.putty.org/).

@DominikVogel
DominikVogel / here_in_CodeOcean.markdown
Last active May 3, 2021 12:05
Use R package here in Code Ocean

Using the here R package in Code Ocean

here package: https://cran.r-project.org/web/packages/here/index.html

Challenge: Code is run in code subfolder. here things this is the base folder. Subsequent stuff breaks

Solution: Create empty .here file in root directory using Post-Install Script:

  1. Go to Environment -> Post-Install Script -> Edit Post-Install Script
  2. Add touch .here in a new lie at the end of the file
@DominikVogel
DominikVogel / specific_rtweet_token.R
Created June 25, 2020 15:12
Use specific rtweet token / use token with RScript
# rtweet tries to automatically detect a token for the Twitter API
# This fails when you run the script from the command line with RScript
# If you have multiple tokens, this script also helps selecting the right token
# Code inspired by https://github.com/samzipper/SkeeterStream/blob/master/TestLookupUsers.R
# Requirements:
# You need to have set up a token with rtweet
# More info: https://rtweet.info/articles/auth.html
# Assumption token is stored at /home/username/