Skip to content

Instantly share code, notes, and snippets.

View ysdede's full-sized avatar
🏠
Working from home

ysdede

🏠
Working from home
View GitHub Profile
#!/bin/bash
cd Installer
if [ ! -d "WFInstaller.bat" ]; then
cat <<EOF >WFInstaller.bat
@echo off
for %%i in (*.exe) do start "" /b "%%i"
EOF
@ysdede
ysdede / make-db.sh
Last active December 5, 2021 18:14
#!/bin/bash
# This script will create a postgresql database on ramdisk
# and create jesse_db, jesse user, and grant privileges
# Stop postgresql service if it is running
echo "Trying to stop Postgresql service gracefully, watch ps aux output for it..."
sudo systemctl stop postgresql
sudo service postgresql stop # WSL2
sudo -u postgres /usr/lib/postgresql/14/bin/pg_ctl -D /tmp/ramdisk/db/ stop
@ysdede
ysdede / install_pg14.sh
Created December 7, 2021 15:34
Postgresql 14 installer for Debian (& WSL2)
#!/bin/bash
sudo apt install -y lsb-core libllvm6.0 libpq5 pgdg-keyring wget --allow-unauthenticated
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get -y install postgresql-14
@ysdede
ysdede / Pick-Parameters.py
Last active January 15, 2022 23:33
Pick best parameters from Optuna database
import optuna
import statistics
import json
# This code snippet filters Optuna trials based on performance metrics and standard deviation
# and generates a results.csv file containing all results
# and a SEQ.py file containing all hyperparameters
study = optuna.create_study(study_name="Band5min-LongOnly", directions=["maximize", "maximize"],
storage="postgresql://optuna_user:optuna_password@localhost/optuna_db_3", load_if_exists=True)
@ysdede
ysdede / Optimize-NSGAII.py
Last active January 16, 2022 21:35
Multi-objective NSGAII hyperparameters optimization with Optuna
import json
import signal
import sys
from subprocess import PIPE, Popen, call
import jessetk.utils as utils
import optuna
# Multi-objective NSGAII hyperparameters optimization with Optuna
# Wraps Jesse ai's backtest function as an objective function
@ysdede
ysdede / install_grafana.sh
Created December 22, 2021 19:13
Install Grafana OSS
sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
# Add this repository for stable releases:
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
# Add this repository if you want beta releases:
echo "deb https://packages.grafana.com/oss/deb beta main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
# After you add the repository:
@ysdede
ysdede / install_clickhouse.sh
Created December 22, 2021 20:24
Install Clickhouse
sudo apt-get install apt-transport-https ca-certificates dirmngr
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv E0C56BD4
echo "deb https://repo.clickhouse.com/deb/stable/ main/" | sudo tee \
/etc/apt/sources.list.d/clickhouse.list
sudo apt-get update
sudo apt-get install -y clickhouse-server clickhouse-client
sudo service clickhouse-server start
@ysdede
ysdede / influxdb2.sh
Last active November 25, 2023 19:32
InfluxDB 2.x Open Source Time Series Database on wsl2
wget -qO- https://repos.influxdata.com/influxdb.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdb.gpg > /dev/null
export DISTRIB_ID=$(lsb_release -si); export DISTRIB_CODENAME=$(lsb_release -sc)
echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg] https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list > /dev/null
sudo apt-get update && sudo apt-get install influxdb2
sudo chmod +x /etc/init.d/influxdb
sudo chown root:root /etc/init.d/influxdb
sudo update-rc.d influxdb defaults
sudo update-rc.d influxdb enable
@ysdede
ysdede / influxdb
Created May 10, 2022 12:43
/etc/init.d/influxdb
#!/bin/bash
### BEGIN INIT INFO
# Provides: influxd
# Required-Start: $all
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start the InfluxDB process
### END INIT INFO
@ysdede
ysdede / install_odoo.cmd
Created July 20, 2022 16:03
Prepare enviroment for installing Odoo from source on Windows
git clone https://github.com/odoo/odoo.git
psql -U postgres -W -c "CREATE DATABASE odoo_db1;"
psql -U postgres -W -c "CREATE USER odoo_user1;"
psql -U postgres -W -c "GRANT ALL PRIVILEGES ON DATABASE odoo_db1 to odoo_user1;"
pip install setuptools wheel
pip install -r https://raw.githubusercontent.com/odoo/odoo/15.0/requirements.txt