Posts

Loading .bas file in excel

* Ctrl + Break to stop Macro / Alt + F8 to run "stop function" * Alt + F11 to open VBA editor * Remove old bas and import new bas file restart excel or Alt + F8 to run "start function"

claude code via Azure, in different profile

 In case you need to create a different profile, you can use following in bashrc: alias azure_claude=' CLAUDE_CONFIG_DIR="$HOME/.azure_claude" \ CLAUDE_CODE_USE_FOUNDRY=1 \ ANTHROPIC_DEFAULT_SONNET_MODEL="claude-sonnet-4-6" \ ANTHROPIC_DEFAULT_HAIKU_MODEL="claude-haiku-4-5" \ ANTHROPIC_DEFAULT_OPUS_MODEL="claude-opus-4-6" \ ANTHROPIC_FOUNDRY_BASE_URL="https://<project>.services.ai.azure.com/anthropic" \ ANTHROPIC_FOUNDRY_API_KEY=<API_KEY> \ /home/qspcadmin/.local/bin/claude'

installing LineageOS, via Claude code

Asked Claude code to install LineageOS on my old phone. It installed it but had to give below finishing touches in order for Sim to work properly. Your OnePlus 6T is now fully set up with LineageOS 22.2 + Google Apps, and the Tello SIM is connected to LTE. If the issue recurs after a reboot, just dial *#*#4636#*#* on the phone to open the Radio Info screen and turn the radio on again.  1. Look for "Preferred Network Type" dropdown — set it to LTE/WCDMA/GSM auto  2. Look for a "Turn on Radio" or "Radio Power" button — tap it to turn the radio ON

Linux comand line autocomplete

    INDICATORS_DIR=/projects/equities/simulation/indicators    _daily_indicator_complete() {        local cur prev words        cur="${COMP_WORDS[COMP_CWORD]}"        prev="${COMP_WORDS[COMP_CWORD-1]}"        words="${COMP_WORDS[*]}"        # Only activate when command line contains daily_*.py        [[ "$words" == *daily_*.py* ]] || return        if [[ "$prev" == "-i" || "$cur" == *,* ]]; then            local indicators=$(ls "$INDICATORS_DIR"/*.py 2>/dev/null \                | xargs -n1 basename | sed 's/\.py$//' | sort -u)            if [[ "$cur" == *,* ]]; then                local prefix="${cur%,*},"                local last="${cur##*,}" ...

SSH port forwarding

following command will make server think 8194 port on the server is open and all requests will be forwarded to the machine FROM WHICH you are SSHing.  ssh -R 8194:localhost:8194 username@server

Restrict Chrome profiles

 If you want to restrict chrome profiles to a specific profile only, you need to create following file: harshal@HP-Desktop:~$ cat /etc/opt/chrome/policies/managed/temp.json { "BrowserAddPersonEnabled": false, "BrowserGuestModeEnabled": false, "IncognitoModeAvailability": false, "IPFSEnabled": false, "RestrictSigninToPattern": "*", "BrowserSignin": 2, } harshal@HP-Desktop:~$

dell inspiron WiFi adapter not detected in Ubuntu 24.04

  sudo apt-get remove bcmwl-kernel-source sudo apt-get install firmware-b43-installer b43-fwcutter cat /etc/modprobe.d/* | egrep 'bcm' (You may want to copy this) and see if the term 'blacklist bcm43xx' is there. If it is, type cd /etc/modprobe.d/ and then sudo gedit blacklist.conf Put a # in front of the line: blacklist bcm43xx

clean csv columns

  pip install csvkit csvcut -c <column1>,<column2> file.csv

Getting external facing IP

 * curl ifconfig.me

Generating your own certificate

* openssl req -newkey rsa:2048 -nodes -keyout myCompany.key -out myCompany.csr * openssl x509 -signkey myCompany.key -in myCompany.csr -req -days 365 -out myCompany.crt

Get versions of python modules installed

 pip freeze | egrep 'pandas|pandas_market_calendars' if you want to install a specific version: pip install pandas_market_calendars==4.5.1

ssh banners

 This command will output SSH banners from the server as pseudo-terminal is not allocated. #!/bin/bash ssh <user>@<server> << EOF echo 'hi A' EOF In order to remove the banner, we can either change the command as follows: #!/bin/bash ssh <user>@<server> 'exec bash' << EOF echo 'hi A' EOF or easiest way is  touch ~/.hushlogin

Zip file exploration

 in data exploration, when you have a lot of zip files, you need a way to look at the cotents with extracting each zip file. zcat file.log.zip | less unzip -p archive.zip file1.txt | less OR the best way vim archive.zip

VSCode (Not Visual Studio)

  Shortcuts: Ctrl+P - Open a file Ctrl+Alt+F - Search for a file in Explorer Extensions: Remote Explorer - SSH Git Lense - Git integration Data wrangler - Table view of data frames Zip Tools - Exploring zip files in a data set Windsurf / Codium - Auto Completion R-debugger via command line : install.packages("vscDebugger", repos = "https://manuelhentschel.r-universe.dev") # r-debugger vscode extension

Sending email from Python

 Can setup SMTP inside python itself but for better protection, setup sendmail with SMTP as in other post and then: More focused module :  def send_mail ( email , subject , body = "" , dataframe_dict = {}):     html_content = ""     for name , df in dataframe_dict .items():         html_content += f "<h3> { name } </h3>"         html_content += df .to_html( escape = False , classes = 'table table-striped' , table_id = 'dataframe' )         html_content += "<br><br>"     styled_html = f """     <html>     <body>         { body }         <br><br><br><br>         { html_content }     </body>     </html>     """     # Send HTML email using mail command     process = subprocess...

Bloomberg BQL

 BQL is not part of daily limit. So we can use those to get the data even when limit is hit: =@BQL.QUERY("get(" & TEXTJOIN(",", TRUE, B1:E1) & ") for(members('RAY Index'))","cols=7;rows=5919") where cells B1 to E1 have fields as follows: market_cap px_volume 30_day_average_volume_at_time factor_expected_daily_volume

Python Selenium Webdriver sample program

 this is a sample program using selenium to click a button: from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager import time # Set up Chrome options chrome_options = webdriver.ChromeOptions() chrome_options.add_argument("--headless")  # Run in headless mode (no UI) chrome_options.add_argument("--disable-gpu")  # Disable GPU acceleration for headless mode chrome_options.add_argument("--no-sandbox")  # Disable sandboxing for headless mode chrome_options.add_argument("--disable-dev-shm-usage")  # Fix shared memory issues # Set up ChromeDriver using Service (Selenium 4) service = Service(ChromeDriverManager().install()) # Initialize WebDriver (Chrome) with the path to your ChromeDriver driver = webdriver.Chrome(service=service, options=chrome_options) try:     # Open the website     driver.get("http://omsprodapp:99...

logger.sh

  #!/bin/bash source /home/ $LOGNAME /.env # Ensure at least two arguments are provided if [ " $# " -lt 2 ]; then     echo "Usage: $0 <command> <file_path> [additional_args...]"     exit 1 fi # Extract filename from the second argument filename = $( basename " $2 " ) # Define log directory and log file path log_dir = "/stage/ $LOGNAME /logs/ $filename " log_file = " $log_dir /$( date +%d).log" # Create log directory if it doesn't exist mkdir -p " $log_dir " # Redirect STDOUT and STDERR to the log file (no output on terminal) exec >> " $log_file " 2>&1 echo "Executing " $@ " at ` date `" # Execute the provided command eval " $@ "

Windows 11 Pro cannot grab window when maximized

 Win + R -> "control access.cpl" Make the mouse easier to use UnCheck "Prevent windows from being automatically arranged"

Loading env file in bash

 If you want to load .env file before running a command in bash, we can use following utility. (Can use the just the command as well.) 14:54:00 harshal@HP:~$ set -a; source ~/.env; set +a; CMD or 14:55:42 harshal@HP:~$ cat ~/load_dot_env.sh set -a; source ~/.env; set +a 14:55:47 harshal@HP:~$ source ~/load_dot_env.sh  14:55:49 harshal@HP:~$