Skip to content

Instantly share code, notes, and snippets.

@nadavrot
nadavrot / Matrix.md
Last active Jan 23, 2022
Efficient matrix multiplication
View Matrix.md

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).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@ivanopagano
ivanopagano / metals-sublime.md
Last active Feb 8, 2019
Using Metals LSP with Sublime 3
View metals-sublime.md

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

Setup

My working setup is specific:

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

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

https://web.stanford.edu/~hastie/ElemStatLearn/

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

Usage

@khardix
khardix / download.py
Created Oct 6, 2017
Python AsyncIO/aiohttp downloader with progressbars
View download.py
#!/usr/bin/env python3.6
import asyncio
from contextlib import closing
import aiohttp
import tqdm
async def download(session, url, progress_queue):
@maxogden
maxogden / bibtex.png
Last active Jan 19, 2022
How to make a scientific looking PDF from markdown (with bibliography)
@karpathy
karpathy / nes.py
Last active Nov 16, 2021
Natural Evolution Strategies (NES) toy example that optimizes a quadratic function
View nes.py
"""
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
np.random.seed(0)
# the function we want to optimize
@mixxorz
mixxorz / graphene.py
Last active Jan 11, 2022
Get requested fields from ResolveInfo. Graphene python.
View graphene.py
"""
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
yang-wei / decode.md
Last active Feb 13, 2020
Elm Json.Decode tutorial and cheatsheet
View decode.md

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
hfreire / qemu_osx_rpi_raspbian_jessie.sh
Last active Nov 28, 2021
How to emulate a Raspberry Pi (Raspbian Jessie) on Mac OSX (El Capitan)
View qemu_osx_rpi_raspbian_jessie.sh
# 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 \
https://github.com/dhruvvyas90/qemu-rpi-kernel/blob/master/kernel-qemu-4.1.7-jessie
export RPI_KERNEL=./kernel-qemu-4.1.7-jessie
# Download filesystem and export location
@obenshaindw
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