Skip to content

Instantly share code, notes, and snippets.

View jonchang's full-sized avatar
🐢
I may be slow to respond.

Jonathan Chang jonchang

🐢
I may be slow to respond.
  • Los Angeles
View GitHub Profile
[Unit]
Description=example cifs share automount
[Automount]
Where=/mnt/net/cifs/example
[Install]
WantedBy=multi-user.target
@jonchang
jonchang / test.py
Created March 8, 2022 23:11
concurrent.futures example
# concurrent.futures example
# - submits work to task pool asynchronously
# - post-process results as they come in
from concurrent.futures import ProcessPoolExecutor, as_completed
from time import sleep
from random import randint
def do_some_work(item):
@jonchang
jonchang / example.tex
Created February 24, 2018 22:45
Example LaTeX source for mcexam package
\documentclass[twoside]{article}
\usepackage[english]{babel}
% set fonts
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mathpazo}
\usepackage{microtype}
\usepackage{etoolbox}
@jonchang
jonchang / parse_fasta.py
Created September 7, 2013 00:53
Python utility function: Given a path tries to parse a FASTA file. Returns an iterator which yields a (name, sequence) tuple
def parse_fasta(path):
"""Given a path tries to parse a fasta file. Returns an iterator which
yields a (name, sequence) tuple"""
with open(path) as handle:
name = sequence = ""
for line in handle:
line = line.strip()
if line.startswith(">"):
if name:
yield name, sequence
@jonchang
jonchang / logs.md
Created April 22, 2020 12:28
icu4c 66.1 logs
test --verbose alexjs
==> brew test --verbose alexjs
Testing alexjs
/usr/bin/sandbox-exec -f /private/tmp/homebrew20200421-31578-r3thdm.sb ruby -W0 -I $LOAD_PATH -- /usr/local/Homebrew/Library/Homebrew/test.rb /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/alexjs.rb --verbose
==> /usr/local/Cellar/alexjs/8.1.1/bin/alex test.txt 2>&1
sh: line 1: 31587 Abort trap: 6 /usr/local/Cellar/alexjs/8.1.1/bin/alex test.txt 2>&1
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.64.dylib
number formula count percent
19 libtasn1 153,485 0.83
198 cocoapods 18,533 0.10
228 emacs 14,126 0.08
239 gdal 12,346 0.07
243 mono 11,922 0.06
331 libiconv 6,618 0.04
341 qemu 6,235 0.03
355 kafka 5,809 0.03
365 glfw 5,611 0.03
@jonchang
jonchang / fsc26.md
Last active January 6, 2020 20:23
applying the stick of correction to fastsimcoal

R error for P2C2M SNAPP:

dyld: Library not loaded: /usr/local/lib/libgomp.1.dylib
  Referenced from: /Users/jonchang/Downloads/Tutorial/example_mode1/./fsc26
  Reason: image not found

fsc26 is looking for GCC in the wrong place

Run mdfind to figure out where GCC actually is. It can't find libgomp.1.dylib so search for:

#!/usr/bin/env Rscript
library(tidyverse)
req <- jsonlite::fromJSON("https://formulae.brew.sh/api/analytics/install-on-request/30d.json")$items
inst <- jsonlite::fromJSON("https://formulae.brew.sh/api/analytics/install/30d.json")$items
req <- req %>% transmute(formula, install_on_request = as.numeric(str_replace_all(count, ",", "")))
inst <- inst %>% transmute(formula, installs = as.numeric(str_replace_all(count, ",", "")))
@jonchang
jonchang / eti_keyboard_shortcuts.user.js
Last active March 4, 2018 06:14
ETI Keyboard Shortcuts
// ==UserScript==
// @name ETI Keyboard Shortcuts
// @namespace shoecream@endoftheinter.net
// @description Adds keyboard shortcuts to streamline your shitposting
// @match *://boards.endoftheinter.net/*
// @match *://endoftheinter.net/*
// @grant GM.openInTab
// @version 0.17
// ==/UserScript==
@jonchang
jonchang / unconcatenate_phylip.py
Last active November 18, 2017 22:19
Unconcatenates a RAxML-style phylip/partitions file
#!/usr/bin/env python3
# By Jonathan Chang - September 2017
import sys, argparse, logging, re, os
def get_partitions(path):
"""Given a path, returns a dictionary with partition names as keys and a list of
length 2, representing a range of characters."""