Skip to content

Instantly share code, notes, and snippets.

View khufkens's full-sized avatar

Koen Hufkens khufkens

View GitHub Profile
@veekaybee
veekaybee / normcore-llm.md
Last active March 19, 2024 09:54
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

@charliejhadley
charliejhadley / plot-click-with-geom_sf.R
Created June 29, 2021 14:35
Demonstration of plotOutput("gg_map", click = "ggmap_click") functionality for geom_sf()
library("shiny")
library("tidyverse")
library("rnaturalearthdata")
library("sf")
# Using Africa instead of whole world as countries110 contains
# 3 invalid geometries. Also, too many examples use the USA everytime
africa_sf <- countries110 %>%
st_as_sf() %>%
st_transform(4326) %>%
@JosiahParry
JosiahParry / gdoc_to_rmd.R
Created October 26, 2019 23:35
Convert a Google Doc to an R Markdown Doc
library(googledrive)
# authenticate yourself
drive_auth()
gdoc_to_rmd <- function(drive_id, output, verbose = TRUE, overwrite = FALSE) {
# get the doc
doc <- drive_get(as_id(drive_id))
@eliocamp
eliocamp / tweet_storm.R
Last active October 10, 2022 16:02
Example of posting a twitter thread from R
---
title: "Tweet thread"
author: "Elio Campitelli"
output: github_document
---
```{r}
knitr::opts_chunk$set(dev = "png",
tweet_this = TRUE)
@matteodefelice
matteodefelice / show_pv_potential.py
Last active June 27, 2018 09:00
Another CDS Toolbox app to visualise the PV Power Potential ERA5 reanalyses #CDSToolbox. To test the application add a new application in your toolbox workspace and copy & paste the following code. NOTE: the units in the colorbar are wrong (the potential is dimensionless) but I couldn't find a way to remove it.
import cdstoolbox as ct
@ct.application(title='PV Power Potential',
description = 'Computation of PV Power potential for a specific day using the dimensionless described in Mavromatakis et al. https://doi.org/10.1016/j.renene.2009.11.010',
abstract = 'Lorem Ipsum')
@ct.input.dropdown('show_year', values=range(2010, 2017))
@ct.input.dropdown('region', values=['Europe', 'China'])
@ct.input.text('month', type = int, label='Month', default=7)
@ct.input.text('day', type = int, label='Day', default=1)
# This example demonstrates running furrr code distributed on 2 AWS instances ("nodes").
# The instances have already been created.
library(future)
library(furrr)
# Two t2.micro AWS instances
# Created from http://www.louisaslett.com/RStudio_AMI/
public_ip <- c("34.205.155.182", "34.201.26.217")
@fbreitwieser
fbreitwieser / acc.R
Created April 27, 2018 14:45
common legend with cowplot
a = read.delim("~/Accuracy_as_a_function_of_sketch_size_and_set_size.txt")
head(a)
a$rel_error = sqrt(a$Mean.squared.error) / a$Exact.size
a$p = factor(a$Sketch.size..log2.)
library(cowplot)
library(ggplot2)
plot1 = ggplot(a, aes(x=Exact.size, sqrt(Mean.squared.error) / Exact.size,
@J-Cleeland
J-Cleeland / albatross_breeding_cycle.Rmd
Last active June 18, 2018 21:10
Circular timeline of Southern Ocean albatross breeding cycles using ggplot. Note: BBA, black-browed albatross; LMA, light-mantled albatross; GHA, grey-headed albatross; WA, Wandering albatross.
---
title: "albatross_breeding_cycle"
author: "Jaimie Cleeland jaimie.cleeland@utas.edu.au"
date: "12/12/2016"
output: html_document
---
Load libraries
```{r}
library(dplyr)
@Rambou
Rambou / gist:c6769caee19b0b9915d8342b86c3ef72
Last active June 13, 2022 09:39
Installing Nvidia propreatary drivers in Linux with UEFI enabled
If, like me, your are booting with UEFI (because having a triple boot ubuntu-windows-mac or because UEFI is the most modern type of bootloader and successor of EFI :p), you have to sign the proprietary modules each time they are recompiled (or upgrade kernel version) so that they are allowed to be loaded in the kernel.
1) Step one, create a self-signed certificate to sign nvidia driver:
sudo openssl req -new -x509 -newkey rsa:2048 -keyout UEFI.key -outform DER -out UEFI.der -nodes -days 36500 -subj "/CN=rambou_nvidia/"
2) step two load and store certificate in a supplementary key database MOC
sudo mokutil --import UEFI.der
3) step three reboot your system
At this step after reboot you will be prompted to select your certificate to import in in key database. If you have inserted a password at certificate creation you'll be prompted to insert it. If you are not prompted, you may have to enter the BIOS by using function keys at boot time.
@andrie
andrie / doSNOW.R
Created October 21, 2015 10:08
Progress bars with foreach and doSNOW
library(doSNOW)
library(tcltk)
cl <- makeSOCKcluster(2)
registerDoSNOW(cl)
pb <- txtProgressBar(max=100, style=3)
progress <- function(n) setTxtProgressBar(pb, n)
opts <- list(progress=progress)
r <- foreach(i=1:100, .options.snow=opts) %dopar% {