Skip to content

Instantly share code, notes, and snippets.

View kiendang's full-sized avatar
🐶

Kien Dang kiendang

🐶
View GitHub Profile
@ivanopagano
ivanopagano / metals-sublime.md
Last active February 8, 2019 09:17
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

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 December 24, 2022 17:44
PDF bookmarks for "Hastie, Tibshirani, Friedman - The Elements of Statistical Learning" (LaTeX)

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

@obenshaindw
obenshaindw / Add dbSNP IDs to a VCF file
Last active August 21, 2023 21:47
Add dbSNP IDs to a VCF file that doesn't have them.
#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
@karpathy
karpathy / nes.py
Last active October 23, 2023 17:50
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
np.random.seed(0)
# the function we want to optimize
@mixxorz
mixxorz / graphene.py
Last active February 15, 2024 16:18
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
@max-mapper
max-mapper / bibtex.png
Last active March 10, 2024 21:53
How to make a scientific looking PDF from markdown (with bibliography)
bibtex.png
@hfreire
hfreire / qemu_osx_rpi_raspbian_jessie.sh
Last active March 24, 2024 14:35
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 \
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
@simme
simme / Install_tmux
Created October 19, 2011 07:55
Install and configure tmux on Mac OS X
# First install tmux
brew install tmux
# For mouse support (for switching panes and windows)
# Only needed if you are using Terminal.app (iTerm has mouse support)
Install http://www.culater.net/software/SIMBL/SIMBL.php
Then install https://bitheap.org/mouseterm/
# More on mouse support http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
@yang-wei
yang-wei / decode.md
Last active April 2, 2024 20:18
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
@khardix
khardix / download.py
Created October 6, 2017 11:26
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):