Skip to content

Instantly share code, notes, and snippets.

Avatar

Kent Kawashima kentwait

View GitHub Profile
@kentwait
kentwait / python_pool_processes.ipynb
Last active Oct 28, 2015
How to use a pool of processes to speed up analysis in Python
View python_pool_processes.ipynb
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 Jun 12, 2018
Understanding networks through descriptive statistics
View network_summary_stats.ipynb
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 Jun 11, 2021
Install HDF5 and h5py supporting MPI (Parallel HDF5)
View hdf5_h5py_install.md

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 Apr 16, 2022
Mount VirtualBox shared folder on boot using fstab
View mount_vbox_shared_boot.md

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 Feb 23, 2017
Docker command tricks
View docker_cmd_tricks.md

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 May 4, 2022
How to set-up CUDA, BEAGLE, and MrBayes/BEAST
View cuda-beagle-beast_setup.md

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.

View genetic_code.py
GENETIC_CODE = {
'AAA': 'K',
'AAC': 'N',
'AAG': 'K',
'AAT': 'N',
'ACA': 'T',
'ACC': 'T',
'ACG': 'T',
'ACT': 'T',
'AGA': 'R',
View python-code-test.py
# 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:
View fibo_example.py
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):
View Raspbian_lite
# 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