Friday, September 6, 2024

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

Tuesday, September 3, 2024

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."
        },
        {
          "role": "user",
          "content": "$diff"
        }
      ],
      "temperature": 0.3
}
EOF
    )
    commit_message=$(echo "$response" | grep '"content":' | cut -d '"' -f 4)
    echo "Generated commit message: $commit_message"
    git commit -m "$commit_message"
}
 

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