Skip to content

Instantly share code, notes, and snippets.

@kentwait
kentwait / python_pool_processes.ipynb
Last active October 28, 2015 07:20
How to use a pool of processes to speed up analysis in Python
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kentwait
kentwait / network_summary_stats.ipynb
Last active June 12, 2018 20:47
Understanding networks through descriptive statistics
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kentwait
kentwait / hdf5_h5py_install.md
Last active June 11, 2021 14:25
Install HDF5 and h5py supporting MPI (Parallel HDF5)

How to install HDF5 and h5py supporting MPI on OS X

Works on Mac OS 10.11.6, HDF5 1.8.17

HDF5

  1. Download and install dependencies like zlib, openmpi. Use homebrew.
  2. Download source tarball from http://www.hdfgroup.org/HDF5/release/obtain5.html
  3. Configure Makefile using the following command:
$ CC=/usr/local/bin/mpicc ./configure --with-zlib=/usr/local/opt --disable-fortran --prefix=/usr/local/ --enable-shared --enable-parallel
@kentwait
kentwait / mount_vbox_shared_boot.md
Last active November 14, 2023 11:22
Mount VirtualBox shared folder on boot using fstab

How to mount a VirtualBox shared folder when the Guest OS boots

Problem

While using VirtualBox's Guest Additions to mount shared folders provides a seamless way to mount shared folders, there are also disadvantages.

  • Shared folders will always mount in /media/sf_(share name) unless specified using through vbox drivers in the guest OS
  • Mounting does not happen at boot-time. Applications that require paths at boot will not be able to access the shared folder even after it is mounted - such as Docker.

Solution

Instead of relying on Guest Additions, if you have sudo permissions, shared folders can be mounted at boot-time using fstab. Using this approach allows

@kentwait
kentwait / docker_cmd_tricks.md
Last active February 23, 2017 09:44
Docker command tricks

Remove ALL containers

docker rm -f $(docker ps -a -q)

Remove ALL images

docker rmi $(docker images -q)

Remove dangling docker images

docker images -qf dangling=true | xargs docker rmi

Bind docker.sock to access docker commands from inside a container

@kentwait
kentwait / cuda-beagle-beast_setup.md
Last active March 27, 2024 14:10
How to set-up CUDA, BEAGLE, and MrBayes/BEAST

Overview

Bayesian phylogentic programs like MrBayes and BEAST work better when the BEAGLE library is installed. BEAGLE provides these programs with an MCMC sampler using CPU-based or GPU-based computation. Therefore, before compiling or using MrBayes and BEAST, BEAGLE and other prerequisites must be set-up and installed first. Unfortunately, setting-up all these software and libraries can become pretty frustrating very quickly.

Here I show how to properly set-up these programs to keep your frustration to a minimum. Broadly speaking, these instructions are applicable for Windows, Mac, and Linux. However, because I am specifically recounting my own experiencing setting-up my Linux machine, the more detailed parts of this guide focuses on installing on Linux.

@kentwait
kentwait / genetic_code.py
Last active March 9, 2018 06:56
Genetic code
GENETIC_CODE = {
'AAA': 'K',
'AAC': 'N',
'AAG': 'K',
'AAT': 'N',
'ACA': 'T',
'ACC': 'T',
'ACG': 'T',
'ACT': 'T',
'AGA': 'R',
# 1. What will the following code print out?
x = 0
if x > 10:
print(True)
else:
print(False)
# 2. Refer to the following function
def f(a, b=0):
if 0 in a:
def fibo_r(x):
if x <= 2:
return 1
return fibo_r(x-1) + fibo_r(x-2)
def fibo_l(x):
l = [0, 1, 1]
if x <= 2:
return 1
for i in range(3, x):
# Add .asoundrc file
Copied from https://gist.github.com/AfzalivE/54214bf437ca1775b5b8e7934cc137db
```
# ps3 eye + 3.5mm speaker Raspberry Pi
## Suggested by http://julius.sourceforge.jp/forum/viewtopic.php?f=9&t=66
## Modified by https://github.com/afzalive
pcm.jack {
type hw
card ALSA