Posts

Launch multiple instances of Ollama Engines

Configure and start first instance on default port export OLLAMA_HOST="0.0.0.0:11434" export OLLAMA_KEEP_ALIVE="18h" export OLLAMA_NUM_PARALLEL="4" export OLLAMA_CONTEXT_LENGTH="8192"  ollama serve Configure and start second instance on another port export OLLAMA_HOST="0.0.0.0:11435" export OLLAMA_MODELS=" $HOME/ .ollama/models-instance-2"  export OLLAMA_KEEP_ALIVE="10m" export OLLAMA_NUM_PARALLEL="2" export OLLAMA_CONTEXT_LENGTH="8192"  ollama serve Configure Ollama client pointing to first instance export OLLAMA_HOST="0.0.0.0:11434" ollama list  Configure Ollama client pointing to second instance export OLLAMA_HOST="0.0.0.0:11435" ollama list   

Fast Node Manager (fnm) Essential Commands

Fast Node Manager (fnm) allows to install and manage node runtime in a simple way. ### Install fnm on Mac     brew install fnm ### Upgrade existing fnm on Mac     brew upgrade fnm ### Shell setup on Mac with zsh / bash For zsh, add the following to your .zshrc profile     eval "$(fnm env --use-on-cd --shell zsh)" or For bash, Add the following to your .bashrc profile     eval "$(fnm env --use-on-cd --shell bash)" ### List all available versions to install     fnm list-remote ### List only LTS versions to install     fnm list-remote --lts ### List all local installed versions     fnm list ### List the current default version     fnm default ### Install a node version     fnm install v24.22.1 ### Set version of node for current shell     fnm use v22.23.4 ### Set default version of node for all shells     fnm default v22.23.4 ### See the current version of node in the shell ...

Ollama Essential Commands

## Start Ollama Engine     ollama serve ## Make Ollama Accessible to other computers within same network     OLLAMA_HOST="0.0.0.0:11434" ollama serve ## Make Ollama Accessible only on localhost     OLLAMA_HOST="127.0.0.1:11434" ollama serve ## Change Ollama Listening Port     OLLAMA_HOST="0.0.0.0:11435" ollama serve ## Run with multiple configuration changes       OLLAMA_HOST="0.0.0.0:11434" OLLAMA_KEEP_ALIVE="-1s" ollama serve  ## Other environment variables to change default Ollama configuration      OLLAMA_CONTEXT_LENGTH="8192" -> Increase context length      OLLAMA_KEEP_ALIVE="-1s" -> Keep running a model continuously without offloading or freeing up memory. Set it to positive values like "4m" or "10m" to free up memory when ollama is idle      OLLAMA_NUM_PARALLEL= "4"    -> Allows upto 4 concurrent requests     OLLAMA_MAX_LOADED_MODELS="5...

Access Services on Macbook from another Macbook or Android phone using local wifi network

Run a sample docker nginx service docker run -it --rm -p 8080:80 --name my-web-service nginx Check the service locally curl 'http://localhost:8080/' Disable firewall on Macbook sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off Check the firewall status sudo /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate Set the network name of the macbook sudo scutil --set LocalHostName macbook-pro-2020 Check the network name of the macbook scutil --get LocalHostName Check the local network ip address of the macbook ifconfig en0 | grep 'inet ' Ping from another macbook to confirm the ip address ping macbook-pro-2020.local Access the sample docker service using the network name from another macbook or android phone curl 'http://macbook-pro-2020.local:8080/'

Open Macbook / MacOS Application from command line

List available application names ls -1 /Applications  Open an application by name open -a 'IntelliJ IDEA OSS.app'

Make MacOS zsh shell to be compatible with bash shell commands

Enable it temporarily in current shell / terminal # Load Zsh's native completion system, then load the Bash compatibility bridge autoload -Uz compinit && compinit autoload -Uz bashcompinit && bashcompinit Enable it automatically by adding the above commands to ~/.zprofile or ~/.zshrc file 

Define and Execute custom shell function on Unix Bash or Mac Zsh

Add the below function to ~/.bash_profile or ~/.zprofile file # Continuously print the current timestamp until Ctrl+C is pressed clockon() {     # Clear the screen initially (optional)     clear     echo "Press [CTRL+C] to stop."     echo "------------------------"          while true; do         # \r overwrites the current line instead of scrolling down         printf "\rCurrent Time: %s" "$(date '+%Y-%m-%d %H:%M:%S')"         sleep 1     done } Source the file or close and reopen the Terminal     source ~/.bash_profile  or      source ~/.zprofile List the function available on the shell     compgen -A function | grep 'clockon' Execute the function     clockon