Posts

Showing posts from 2024

Docker commands

 Was trying to create a docker for android. Here are the commands I used: * sudo apt-get install qemu-kvm * curl -fsSL https://get.docker.com -o get-docker.sh * sh ./get-docker.sh *docker run -d -p 6080:6080 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true --device /dev/kvm budtmo/docker-android:emulator_13.0 * sudo chmod 666 /var/run/docker.sock  (if permission denied in previous step) * docker ps * docker stop <NAME>

Date conversion in MySQL

With recent release, MySQL throws error when inserting dates. This is because, by default "strict mode" is enabled. To get rid of the errors, we need to do something as follows: SHOW VARIABLES LIKE 'sql_mode' ; set sql_mode= '' ;

Installing IBC (Interactive Broker Controller)

 This is a nice utility to keep ibkr TWS running. These are the commands : $ wget https://github.com/IbcAlpha/IBC/releases/download/3.20.0/IBCLinux-3.20.0.zip $ sudo unzip IBCLinux-3.20.0.zip -d /opt/ibc $ sudo chmod o+x /opt/ibc/*.sh /opt/ibc/*/*.sh $ cat ~/ibc/config.ini      IbLoginId=<username>      IbPassword=<password> $ rm IBCLinux-3.20.0.zip

New Linux installation checklist

sudo apt install ~/Downloads/google-chrome-stable_current_amd64.deb sudo apt-get install gnome-browser-connector sudo apt install libreoffice sudo apt install git-all ssh-keygen -t rsa sudo snap install code sudo apt install python3-venv python3 -m venv ~/.venv/ibkr_python https://extensions.gnome.org/extension/1160/dash-to-panel/ Dash-to-panel settings (right click) -> ungroup applications settings -> system -> date/time -> show weekday Install vscode, extensions- python

git commands

Following are basic git commands which should be sufficient for most of the git use : git fetch git pull git commit git push Automated script to commit: #!/bin/bash ssh qspcadmin@USAZLINUXQSPCQ01 << EOF cd /stage/qspcadmin/projects/sas git fetch git pull git add . git commit -m "Automated Commit" git push EOF Automated bashrc function to commit with good message: function gpt_commit() {     diff=$(git diff)     response=$(curl -s -X POST https://api.openai.com/v1/chat/completions \       -H "Authorization: Bearer $OPENAI_API_KEY" \       -H "Content-Type: application/json" \       -d @- <<EOF {       "model": "gpt-4o-mini",       "messages": [         {           "role": "system",           "content": "You are an assistant that writes concise and informative git commit messages based on the provided git diff." ...

Security cameras from desktop

 Need to install ffmpeg in order to access rstp streams * sudp apt install ffmpeg Once it is installed, you can access the cameras via * ffplay rtsp://hpatil:<pass>@<ip_address>:554/stream1

More than one ssh key for the github

 * Generate new key: [18:05:20 harsshal@dell:~/projects]$ ssh-keygen -t ed25519 -C "harsshal@gmail.com" * Add new key in the ssh config [18:07:35 harsshal@dell:~/projects]$ cat ~/.ssh/config  TCPKeepAlive yes Host 10.234.1.112   HostName 10.234.1.112   User harshal # Default GitHub Host github.com   HostName github.com   User git   IdentityFile ~/.ssh/id_rsa Host github-public   HostName github.com   User git   IdentityFile ~/.ssh/id_ed25519.pub Host github-personal   HostName github.com   User git   IdentityFile ~/.ssh/id_ed25519 * Clone the repo [18:09:02 harsshal@dell:~/projects]$ git clone git@github-personal:harsshal/icarus_gl.git

Jupyter notebook setup

jupyter notebook password cat ~/.ipython/profile_default/startup/start.ipy import os import dotenv dotenv.load_dotenv('/home/'+os.environ['LOGNAME']+'/.env',override=True) import pandas as pd # Pandas options pd.options.display.max_columns = None pd.options.display.max_rows = None pd.options.display.max_colwidth = None           pd.options.display.float_format = '{:,.2f}'.format print("Everything loaded") jupyter notebook --notebook-dir [LOCATION] --no-browser --ip=192.168.255.X jupyter nbconvert --execute --to html notebook.ipynb

Installing a module directly from repo

pip install git+https://github.com/blampe/IbPy.git pip install git+https://github.com/atreyuxtrading/atreyu-backtrader-api.git