Skip to content

Instantly share code, notes, and snippets.

Avatar

Kent Kawashima kentwait

View GitHub Profile
View gist:023eab59e85bbe0c6059f24f61cb99f8
[Down] o:50403.85 h:50444.31 l:50222.59 c:50303.48 hao:50410.95 hac:50343.5575 vol:4420.06
[Down] o:50302.05 h:50313.53 l:50120.15 c:50226.84 hao:50352.95 hac:50240.6425 vol:5617.008
[Down] o:50226.84 h:50309.2 l:50151 c:50209.99 hao:50264.445 hac:50224.25749999999 vol:3995.061
[Up] o:50210 h:50393.25 l:50150 c:50160.01 hao:50218.42 hac:50228.315 vol:6494.194
[Down] o:50160 h:50173.02 l:49730 c:49769.26 hao:50185 hac:49958.07 vol:26268.227
[Down] o:49769.26 h:49950 l:49612.18 c:49772.69 hao:49964.630000000005 hac:49776.0325 vol:13958.26
[Down] o:49772.69 h:49789.86 l:49314.14 c:49571.64 hao:49770.975000000006 hac:49612.082500000004 vol:18062.925
[Down] o:49571.64 h:49680 l:49477.44 c:49660.64 hao:49672.165 hac:49597.43000000001 vol:6384.345
[Up] o:49660.64 h:49787 l:49410 c:49756.91 hao:49616.14 hac:49653.637500000004 vol:887
View gist:8c199ee77228eda0f8b5e90ca90fed9f
[Up] HeikinAshiKlineSummary { open_time: 1629733620000, open: 49660.65, high: 49679.19, low: 49623.77, close: 49653.49, volume: 340.212, close_time: 1629733679999, quote_asset_volume: 16891095.04434, number_of_trades: 3343, taker_buy_base_asset_volume: 126.96, taker_buy_quote_asset_volume: 6303688.27145, ha_open: 49647.985, ha_high: inf, ha_low: 49623.77, ha_close: 49654.274999999994 }
[Down] HeikinAshiKlineSummary { open_time: 1629733680000, open: 49653.49, high: 49677.32, low: 49635.24, close: 49660.0, volume: 212.477, close_time: 1629733739999, quote_asset_volume: 10551853.58003, number_of_trades: 2612, taker_buy_base_asset_volume: 117.889, taker_buy_quote_asset_volume: 5854917.85542, ha_open: 49657.07, ha_high: inf, ha_low: 49635.24, ha_close: 49656.5125 }
[Down] HeikinAshiKlineSummary { open_time: 1629733740000, open: 49659.82, high: 49674.26, low: 49629.0, close: 49630.01, volume: 169.779, close_time: 1629733799999, quote_asset_volume: 8428987.70956, number_of_trades: 2096, taker_buy_base_asset_vol
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:

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

@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