Skip to content

Instantly share code, notes, and snippets.

View selfawaresoup's full-sized avatar
💜

Esther Weidauer selfawaresoup

💜
View GitHub Profile
@selfawaresoup
selfawaresoup / life.c
Last active April 4, 2024 19:26
Game of Life in C
#include <ncurses.h>
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
void handle_sigint(int sig) {
endwin();
exit(0);
}
@selfawaresoup
selfawaresoup / apple-health-to-rda.r
Last active April 7, 2024 10:20
Make Apple Health data available for analysis in R as an RDA file.
# This can take quite a long time to run
library(xml2)
library(tidyverse)
read_xml("apple_health_export/export.xml") -> x
x %>% xml_find_all(".//Record") %>%
xml_attrs %>%
bind_rows %>%
@selfawaresoup
selfawaresoup / uconsole.md
Last active April 27, 2024 23:04
Notes for Clockwork uConsole setup

uConsole Notes

Batteries

I use two XTAR 16850-3500 cells and I get about 8h of active usage out of them.

Get GNOME Shell and GDM3

sudo apt install gnome-shell gdm3
@selfawaresoup
selfawaresoup / max-log-lik-2-params.R
Created December 9, 2023 01:02
finding the closest fit of a normal distribution to a set of sample data points
library(tidyverse)
library(scico)
set.seed(2)
mu.0 <- runif(1, -2, 2)
sigma.0 <- runif(1, 0.1, 1)
samples <- rnorm(300, mean = mu.0, sd = sigma.0)
list(
@selfawaresoup
selfawaresoup / dplyr-pipe.r
Created November 1, 2023 22:32
dplyr-pipe tutorial (deutsch)
################################################################################
# "Pipe" operator in R: %>% #
################################################################################
# Vorbereitung
# Bitte einmal dieses R-Script mit "Source" ausführen, damit alles läuft.
# Kann sein, dass R-Studio eine Warnung anzeigt, dass ein Packet fehlt,
# In dem Fall ruhig bestätigen, und dann wird dplyr automatisch installiert.
#
@selfawaresoup
selfawaresoup / rstudio-server-ubuntu.md
Last active November 2, 2023 07:52
Rstudio server setup on ubuntu

How to set up an Rstudio server on Ubuntu

This procedure was tested on Ubuntu 23.04 but should be very similar or identical on other verions.

Note that this will likely not install the latest version of R but the one that is included in the Ubuntu package repository. Installing a newer version can be tricky since the R project doesn't always support all recent releases of major Linux distributions. For most use cases, especially for education, the slightly older version of R will be prefectly fine though.

All commands in this guide need to be run as user root or with sudo.

1 Prepare the machine

@selfawaresoup
selfawaresoup / mastodon-blur-link-preview.js
Last active April 19, 2023 20:01
Userscript for blurring link preview images on Mastodon instances
@selfawaresoup
selfawaresoup / twitter-no-doge.js
Created April 5, 2023 11:41
Twitter Userscript: No Doge
// ==UserScript==
// @name No Doge Twitter
// @match https://twitter.com/*
// @run-at document-start
// @grant GM.addStyle
// ==/UserScript==
let css = `
a[aria-label=Twitter] svg { display: none; }
div[aria-label=Loading…] { display: none; }
@selfawaresoup
selfawaresoup / htoprc
Created February 10, 2023 20:21
Nice htop dashboard
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 20 17 18 38 39 40 109 110 2 46 47 49 1
sort_key=49
sort_direction=1
hide_threads=0
hide_kernel_threads=1
hide_userland_threads=0
shadow_other_users=0
show_thread_names=0
@selfawaresoup
selfawaresoup / domain-blocks.rb
Last active December 29, 2022 13:54
Bulk domain blocks for Mastodon
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'dotenv'
gem 'httparty'
end