Skip to content

Instantly share code, notes, and snippets.

@JCGoran
JCGoran / README.md
Last active November 29, 2023 08:52
Running tmux on CSCS Piz Daint

Since tmux is not available by default on Piz Daint, here's a short guide on how to install and use it there (as of 2020-01-16).

Load the necessary modules:

module load daint-gpu EasyBuild-custom/cscs

Now you can build tmux using:

eb tmux-2.9.eb -r
@bricksroo
bricksroo / App.vue
Last active February 7, 2024 13:03
Reveal.js in Vue
<template>
<div id="app">
<!-- <img src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/> -->
<div class="reveal">
<div class="slides">
<section>Single Horizontal Slide</section>
<section>
<section>Vertical Slide 1</section>
<section>Vertical Slide 2</section>
@Qix-
Qix- / sha256.sh
Last active July 10, 2023 10:00
SHA256 in (mostly) pure Bash script
#!/usr/bin/env bash
# Released into the Public Domain.
#
# Original implementation in C by Brad Conte (brad@bradconte.com) <https://github.com/B-Con/crypto-algorithms>
# Ported to Bash (lol) by Josh Junon (josh@junon.me) <https://github.com/qix->
#
# Yes, it's absolutely as slow as it looks.
#
# The only external dependency it has is on a utility called `od`,
@AustinRochford
AustinRochford / pymc3_bsplines.ipynb
Last active September 15, 2022 21:08
PyMC3 BSplines
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@klmr
klmr / generator.md
Last active August 28, 2022 02:26
Python-like generators in R

A little experiment using restarts.

(And while we’re at it, let’s torture R’s syntax a little.)

![screenshot][]

In the following we will be using R’s “restarts” feature to implement the state machine that drives generators in languages such as Python. Generators allow lazily generating values on demand: a consumer invokes a generator, and consumes values as they are produced. A new value is only produced once the previous one has been consumed.

@vicegd
vicegd / index.html
Last active August 11, 2022 06:51
Reveal.JS - Tables
<section>
<h2>Tablas con información</h2>
<table>
<thead><tr>
<th>Ciudad</th>
<th>Año de fundación</th>
<th>Población</th>
</tr></thead>
<tbody><tr>
<td>Gijón</td>
#cython: wraparound=False, boundscheck=False, cdivision=True, overflowcheck=False
#cython: profile=False, nonecheck=False, cdivision_warnings=True
import numpy as np
cimport numpy as np
from libc.math import sqrt, exp
from sklearn.utils.extmath import fast_dot
from sklearn.metrics.pairwise import pairwise_distances
def diffusion_map(X, n_components=2, metric="euclidean"):
@hrbrmstr
hrbrmstr / cantons.R
Last active November 12, 2018 13:50
Swiss Cantons - R version of http://bl.ocks.org/mbostock/4207744
library(rgeos)
library(rgdal) # needs gdal > 1.11.0
library(ggplot2)
# map theme
devtools::source_gist("https://gist.github.com/hrbrmstr/33baa3a79c5cfef0f6df")
map = readOGR("readme-swiss.json", "cantons")
map_df <- fortify(map)
@thigm85
thigm85 / lda_vs_pca.R
Last active March 16, 2021 11:31
Visualize the difference between PCA and LDA on the iris dataset.
require(MASS)
require(ggplot2)
require(scales)
require(gridExtra)
pca <- prcomp(iris[,-5],
center = TRUE,
scale. = TRUE)
prop.pca = pca$sdev^2/sum(pca$sdev^2)
@romainfrancois
romainfrancois / mod.cpp
Created September 25, 2013 06:42
Problem exposing inherited member function of derived class to R through RCPP_MODULE
#include <Rcpp.h>
using namespace Rcpp;
class B {
public:
B (SEXP b);
};
template <class T> class A {
public: