Skip to content

Instantly share code, notes, and snippets.

@lawnn
lawnn / calc_nasdaq.py
Last active July 9, 2024 15:16
nasdaqを積み立てた時の将来の金額
import matplotlib.pyplot as plt
import datetime
def calculate_future_value(monthly_investment, start_year, end_year, initial_investment, nasdaq_returns):
future_values = [] # 各月の将来価値を格納するリスト
future_value = initial_investment # 初期投資額
# 積立総月数を計算
months = (end_year - start_year) * 12
@lawnn
lawnn / polars_concat.ipynb
Created April 17, 2023 08:11
polars concat
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lawnn
lawnn / pihole_dot.sh
Last active December 10, 2022 09:44
ubuntu20.04LTS IPv6 pihole + unbound + nginx
#!/bin/bash
DNS_DOMAIN_NAME="$1"
SSL_CERT_EMAIL="$2"
WEB_ROOT="/var/www/html"
if [ -z "$DNS_DOMAIN_NAME" ]; then
echo "🛑 Set a valid Private DNS Domain Name"
exit 1
fi
sudo useradd -s /usr/sbin/nologin -r -M cloudflared
echo ""
echo "=============================="
echo "Commandline args for cloudflared, using Cloudflare DNS"
echo "=============================="
echo ""
sudo echo "CLOUDFLARED_OPTS=--port 5053 --upstream https://1.1.1.1/dns-query --upstream https://1.0.0.1/dns-query" >/etc/default/cloudflared
sudo chown cloudflared:cloudflared /etc/default/cloudflared
sudo chown cloudflared:cloudflared /usr/local/bin/cloudflared
sudo echo "[Unit]
@lawnn
lawnn / BF trades.ipynb
Created August 30, 2021 19:39
bf executions
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lawnn
lawnn / GMO trades.ipynb
Last active August 30, 2021 03:30
GMO trades
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lawnn
lawnn / bf_historical.ipynb
Last active August 29, 2021 03:44
bf historical data
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lawnn
lawnn / raspbian1.sh
Last active December 9, 2022 16:01
python3.x setup script for raspbianOS 2021/5/4
version=$1
sudo apt update && sudo apt upgrade -y
sudo apt install build-essential libbz2-dev libdb-dev libreadline-dev libffi-dev libgdbm-dev liblzma-dev libncursesw5-dev libsqlite3-dev libssl-dev zlib1g-dev uuid-dev tk-dev
cd /opt
sudo wget https://www.python.org/ftp/python/$version/Python-$version.tar.xz
sudo tar xJf Python-$version.tar.xz
cd Python-$version
sudo ./configure --enable-optimizations --with-lto; time make -j4
sudo make install
sudo rm -f /opt/Python-$version.tgz
@lawnn
lawnn / c9linux2.sh
Last active March 6, 2025 11:09
EC2 cloud9 amazon linux2 python & ta-lib install script
sudo yum install gcc openssl-devel bzip2-devel libffi-devel sqlite-devel gcc-c++ make git bzip2-devel zlib-devel readline-devel xz-devel
cd /opt
sudo wget https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tgz
sudo tar xzf Python-3.9.5.tgz
cd Python-3.9.5
sudo ./configure --enable-optimizations
sudo make altinstall
sudo rm -f /opt/Python-3.9.5.tgz
python3.9 -V
python3.9 -m venv env