May 30, 2024

Ollama Note


Config

~/.ollama
/usr/share/ollama

Service

/etc/systemd/system/ollama.service

Port 11434


Environment Variables

(https://github.com/ollama/ollama/blob/main/cmd/cmd.go#L1243)

OLLAMA_DEBUG
OLLAMA_HOST
OLLAMA_KEEP_ALIVE
OLLAMA_MAX_LOADED_MODELS
OLLAMA_MAX_QUEUE
OLLAMA_MODELS
OLLAMA_NUM_PARALLEL
OLLAMA_NOPRUNE
OLLAMA_ORIGINS
OLLAMA_TMPDIR
OLLAMA_FLASH_ATTENTION
OLLAMA_LLM_LIBRARY
OLLAMA_MAX_VRAM


E.g. Have Ollama serve external requests




December 27, 2023

Sending emails through GMail on Windows

 


Sending emails through GMail using the Windows Command Line Interface (CLI) can be accomplished through two distinct methods: one utilizing PowerShell (PS1) and the other through the Command Prompt (cmd). Before proceeding, ensure you have obtained an application password for your GMail account.


PowerShell Method:

No additional software is required for this approach. Utilize the following example:

$EmailFrom = "[email protected]"
$EmailTo = "[email protected]"
$Subject = "PS1 email test"
$Body = "Hello there"
$SMTPServer = "smtp.gmail.com"
$SMTPClient = New-Object Net.Mail.SmtpClient($SMTPServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("[email protected]", "AppPassword")
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)


CMD:

For this, you need to download the mailsend software from https://github.com/muquit/mailsend/releases.

mailsend -to RECIPIENT@hello.com -from [email protected]^
  -starttls -port 587 -auth^
  -smtp smtp.gmail.com^
  -sub "test" +cc +bc -v^
  -user "[email protected]" -pass "AppPassword"^
  -M "Hello there"


Note: Ensure you replace placeholders like "[email protected]," "[email protected]" and others with your actual email addresses. Additionally, use the correct application password obtained for your GMail account.


Send emails from Ubuntu with GMail account





If you're looking to send emails from your Ubuntu system using a GMail account, here's a straightforward method using Postfix. Follow these steps to set it up:


Prerequisites:

Ensure you have an application password for your GMail account.


On Ubuntu:

1. Install the necessary software:

$ sudo apt-get update
$ sudo apt-get install postfix mailutils libsasl2-2 ca-certificates libsasl2-modules


2. Edit or add the following lines in the file /etc/postfix/main.cf:

relayhost = [smtp.gmail.com]:587
smtp_tls_security_level=encrypt
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes


3. Add your GMail account and app password to /etc/postfix/sasl_passwd:

[smtp.gmail.com]:587  [email protected]:YOUR_APP_PASSWORD


4. Set permissions:

$ sudo chmod 400 /etc/postfix/sasl_passwd


5. Generate the password file to create /etc/postfix/sasl_passwd.db:

$ sudo postmap /etc/postfix/sasl_passwd


6. Check and restart Postfix:

$ sudo postfix check
$ sudo systemctl restart postfix
$ sudo systemctl status postfix


7. Test the setup:

$ echo "Hello World" | mail -s "Email from Ubuntu using GMail" [email protected]
$ tail /var/log/mail.log


That's it! You should now be able to send emails from your Ubuntu system using your GMail account through Postfix.