Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kentwait
kentwait / create-conda-lock.sh
Last active January 11, 2024 04:06
Create conda-lock of current Conda environment
# Run this script in the directory where you want to save the conda-lock file at
# Activate env to make a `conda-lock.yml` file of
# conda activate venv
# Export env spec list using conda/mamba as `environment.yml`
conda env export > environment.yml
# Make conda-lock file
# Edit platform tag `-p`
# For multiple platforms just add more, e.g. `-p osx-64 -p linux-64`
conda-lock -f environment.yml -p linux-64
# When new packages are installed, the conda environment changes and
@kentwait
kentwait / add_conda_env_to_jupyterlab.sh
Last active January 11, 2024 03:48
Add Conda environment to Jupyterlab
# FIRST, Activate env to add to Jupyter, e.g. venv
# conda activate venv
# Then run this script
# Edit ENV_NAME variable to name the kernel
# Kernel names can only contain ASCII letters and numbers and these separators: - . _ (hyphen, period, and underscore).
# This will be the label in JupyterLab
ENV_NAME=Conda
# Install ipykernel via conda/mamba
conda install ipykernel
# Add current active environment
@kentwait
kentwait / docker-compose.yml
Created January 12, 2023 06:52
Docker Compose for jupyter/datascience-notebook:latest
version: '3.3'
services:
lab:
ports:
- '10000:8888'
container_name: datascience-notebook
volumes:
- '${PWD}:/home/jovyan/work'
image: jupyter/datascience-notebook
@kentwait
kentwait / gist:1e91189b04533c1f6f522ab2468576dd
Created September 9, 2022 04:02
Run remote jupyter in LAN
# On remote (c24.local)
jupyter notebook --no-browser --port=10000
# On current computer
# create a tunnel that runs in the bg
# first set of name:port is local, second set is remote
ssh -f -N -L localhost:10024:localhost:10000 kent@c24.local
three_to_one_aa = {
'Ala': 'A',
'Arg': 'R',
'Asn': 'N',
'Asp': 'D',
'Asx': 'B',
'Cys': 'C',
'Glu': 'E',
'Gln': 'Q',
'Glx': 'Z',
[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
[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

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:

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))
# 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