Skip to content

Instantly share code, notes, and snippets.

nadavrot /
Last active Jan 23, 2022
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).


Matrix multiplication is a mathematical operation that defines the product of

ivanopagano /
Last active Feb 8, 2019
Using Metals LSP with Sublime 3

Using with Sublime

I successfully enabled the metals lsp server to work with sublime text 3

I didn't actually need to write any lsp client, since I'm using the standard LSP Package


My working setup is specific:

  • macOS HIgh Sierra
  • Sublime 3 on Dev channel build 3160
goerz / Elements of Statistical
Last active Dec 10, 2021
PDF bookmarks for "Hastie, Tibshirani, Friedman - The Elements of Statistical Learning" (LaTeX)
View Elements of Statistical

This gist contains out.tex, a tex file that adds a PDF outline ("bookmarks") to the freely available pdf file of the book

The Elements of Statistical Learning (2nd ed), by Trevor Hastie, Robert Tibshirani, and Jerome Friedman

The bookmarks allow to navigate the contents of the book while reading it on a screen.


khardix /
Created Oct 6, 2017
Python AsyncIO/aiohttp downloader with progressbars
#!/usr/bin/env python3.6
import asyncio
from contextlib import closing
import aiohttp
import tqdm
async def download(session, url, progress_queue):
maxogden / bibtex.png
Last active Jan 19, 2022
How to make a scientific looking PDF from markdown (with bibliography)
karpathy /
Last active Nov 16, 2021
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
A bare bones examples of optimizing a black-box function (f) using
Natural Evolution Strategies (NES), where the parameter distribution is a
gaussian of fixed standard deviation.
import numpy as np
# the function we want to optimize
mixxorz /
Last active Jan 11, 2022
Get requested fields from ResolveInfo. Graphene python.
MIT License
Copyright (c) 2018 Mitchel Cabuloy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
yang-wei /
Last active Feb 13, 2020
Elm Json.Decode tutorial and cheatsheet

When receiving JSON data from other resources(server API etc), we need Json.Decode to convert the JSON values into Elm values. This gist let you quickly learn how to do that.

I like to follow working example code so this is how the boilerplate will look like:

import Graphics.Element exposing (Element, show)
import Task exposing (Task, andThen)
import Json.Decode exposing (Decoder, int, string, object3, (:=))

import Http
hfreire /
Last active Nov 28, 2021
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (El Capitan)
# Install QEMU OSX port with ARM support
sudo port install qemu +target_arm
export QEMU=$(which qemu-system-arm)
# Dowload kernel and export location
curl -OL \
export RPI_KERNEL=./kernel-qemu-4.1.7-jessie
# Download filesystem and export location
obenshaindw / Add dbSNP IDs to a VCF file
Last active Jul 25, 2021
Add dbSNP IDs to a VCF file that doesn't have them.
View Add dbSNP IDs to a VCF file
#GATK Method <- Slower and keeps original ID plut dbSNP rsID
# R=Reference FASTA
# V=VCF file to add IDs to
# --dbsnp = dbsnp VCF -- download from NCBI FTP
java -jar GenomeAnalysisTK.jar -R /reference/Homo_sapiens_assembly19.fasta -T VariantAnnotator -V vcf_to_add_id_to.vcf --dbsnp /reference/dbsnp_137.b37.vcf.gz --out /data/Broad.chr1.annotated.vcf
#bcftools Method <- Faster, replaces existing ID with dbSNP rsID
/usr/bin/htslib/bcftools/bcftools annotate -a /reference/dbsnp_137.b37.vcf.gz -c ID vcf_to_add_id_to.vcf