Skip to content

Instantly share code, notes, and snippets.

@mp4096
mp4096 / foobar.cpp
Last active May 17, 2020 14:15
Fun with lifetimes
#include <iostream>
#include <vector>
struct Foo {
float x;
float y;
float z;
};
using Bar = std::vector<float>;

Keybase proof

I hereby claim:

  • I am mp4096 on github.
  • I am mp4096 (https://keybase.io/mp4096) on keybase.
  • I have a public key whose fingerprint is 0639 BFEA 7F2A 577D D8F4 18F2 26F8 94EC B588 E873

To claim this, I am signing this object:

@mp4096
mp4096 / cartesian_product.hs
Created February 23, 2018 08:31
Cartesian product using folder
product xss = foldr f [[]] xss
where f xs yss = foldr g [] xs
where g x zss = foldr h zss yss
where h ys qss = (x : ys) : qss
@mp4096
mp4096 / jt.sh
Created November 15, 2017 13:21
Jupyter themes
# Activate dark theme
jt -t chesterish -f source -T
# Reset to default
jt -r
# Modify ~/.ipython/profile_default/startup/startup.ipy
#
# from jupyterthemes import jtplot
# jtplot.style()
@mp4096
mp4096 / swatch.tex
Last active August 8, 2017 15:22
Nord swatch
\documentclass[10 pt, a4paper]{article}
% ======================================================================
% Use UTF-8 and T1
% ======================================================================
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
% ======================================================================
@mp4096
mp4096 / example.py
Created July 10, 2017 10:20
Store and load Python objects
import joblib
a = 1
b = "hello"
c = 2.71828
# The `compress` argument is optional;
# 9 is the highest compression level
joblib.dump((a, b, c), "foo.xz", compress=9)
@mp4096
mp4096 / matplotlib_palettes.ipynb
Created July 3, 2017 13:04
Palettes in matplotlib
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mp4096
mp4096 / setup.sh
Created June 9, 2017 12:37
Setup bench instance
sudo apt-get update -qq && sudo apt-get upgrade -qq -y
sudo apt-get install -y make clang libiomp-dev
wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh
# reboot
conda install pyyaml numpy pandas joblib
@mp4096
mp4096 / Doxyfile.mustache
Created May 29, 2017 06:47
Doxyfile template
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "{{project_name}}"
PROJECT_NUMBER =
PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = "{{output_dir}}"
CREATE_SUBDIRS = NO
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
@mp4096
mp4096 / python_intro.md
Created April 5, 2017 11:57
An extemely short introduction to Python

An extemely short introduction to Python

  • General information
    • High-level scripting language
    • Dynamic and strong typing
    • Implemented in C (as is NumPy/SciPy)
    • Extremely widespread: Google (YouTube, Google Brain, DeepMind), Dropbox, Microsoft, Intel are the largest supporters
    • Clear, simple syntax
    • Mostly object-oriented, but has a lot of functional influence
  • Named after Monty Python, not the animal!