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 / 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

View genetic_code.py
GENETIC_CODE = {
'AAA': 'K',
'AAC': 'N',
'AAG': 'K',
'AAT': 'N',
'ACA': 'T',
'ACC': 'T',
'ACG': 'T',
'ACT': 'T',
'AGA': 'R',
@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.
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
View gist:37fd8f7d70f1c8f2c0a969ed6bcd5c36
def carrier_square_wave_generator(gpio, frequency, signal_length):
"""
Generate carrier square wave.
"""
waveform = []
# frequency is number of cycles per second, usually 38 kHz
micro_per_cycle = 1000.0 / frequency # 1 / kHz is millisecond, * 1000 is microsecond
# number of cycles during the signal
# signal_length is in microseconds
num_cycles = int(round(signal_length / micro_per_cycle))
@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
View react-tauri-init-macOS.md

HOWTO init a ReactJS-Tauri app in Mac OS

The following instructions have worked for me running Mac OS 11.4.0 X64 with Node.js 16.4.0, Rust 1.53 and Tauri 1.0.0-beta.4.

Init a ReactJS app using npm

First, cd to parent directory where the root directory of the app will be located, ie: /home/me/src. Use the following command to generate the react directory structure: