Showing posts with label AI. Show all posts
Showing posts with label AI. Show all posts

13 April 2026

How to start/stop/enable/disable manually OpenClaw, Hermes, Signal?

Sherman: 

Gemini, both my OpenClaw agent and Hermes agent start automatically when my laptop is turned on. Even when I kill both the processes, both start again in a few seconds.

Could you instruct me to change it, so both do not start automatically, please? I prefer that I start either of the both manually.

 

Gemini:

 

 

It sounds like you're playing a game of "whack-a-mole" with your processes! The reason they keep coming back is that they are managed by systemd. When you kill a process managed this way, systemd sees the "failure" and immediately restarts it to ensure the service stays active.

Based on your setup, here is how to stop them from starting automatically and switch to manual control.

1. Disable the Hermes Gateway (User Service)

Your Hermes agent is running as a user-level service. You’ll need to stop the current instance and then "disable" it so it doesn't launch at boot.

Run these commands in your terminal:

Bash
# Stop the running service
systemctl --user stop hermes-gateway.service

# Prevent it from starting at boot
systemctl --user disable hermes-gateway.service

2. Disable the Signal Daemon (System Service)

Since the Signal daemon (which supports Hermes) runs as a system-wide service, you'll need to use sudo for these:

Bash
# Stop the daemon
sudo systemctl stop signal-daemon.service

# Disable it from starting at boot
sudo systemctl disable signal-daemon.service

3. Regarding OpenClaw

If you are seeing an OpenClaw-related process despite having uninstalled it previously, it might be a leftover service unit or a different script triggering it. You can check if a service still exists for it by running:

systemctl list-unit-files | grep -i openclaw

If it shows up, run:

Bash
sudo systemctl stop openclaw.service
sudo systemctl disable openclaw.service

How to start them manually from now on

Whenever you actually want to use them, you don't need to change your configuration back. Just "start" them for that session only:

  • To start Hermes: systemctl --user start hermes-gateway.service

  • To start Signal: sudo systemctl start signal-daemon.service

Note: Since you have "lingering" enabled for your user account, these services would normally stay running even if you logged out. Disabling them as shown above is the correct way to ensure they only run when you explicitly ask them to.

Does that clear up the "auto-restart" headache for you?

 

Sherman:

 

shermanchen@serverlenovo:~$ systemctl list-unit-files | grep -i openclaw
shermanchen@serverlenovo:~$ 
shermanchen@serverlenovo:~$ 
shermanchen@serverlenovo:~$ 
shermanchen@serverlenovo:~$ 
shermanchen@serverlenovo:~$ lsof -i :18789
COMMAND    PID        USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
openclaw- 4757 shermanchen   22u  IPv4  34619      0t0  TCP localhost:18789 (LISTEN)
openclaw- 4757 shermanchen   23u  IPv6  34620      0t0  TCP ip6-localhost:18789 (LISTEN)
shermanchen@serverlenovo:~$ 
shermanchen@serverlenovo:~$ 
shermanchen@serverlenovo:~$ 
shermanchen@serverlenovo:~$ 
shermanchen@serverlenovo:~$ sudo systemctl stop openclaw.service
Failed to stop openclaw.service: Unit openclaw.service not loaded.
shermanchen@serverlenovo:~$ 

 

Gemini:

That is definitely a bit of a "ghost in the machine" situation! Since systemctl doesn't see a service file, but the process is clearly running and listening on port 18789, it isn't being managed by a standard system-wide service.

The fact that it restarts after being killed suggests something else is acting as a "watchdog." Here is how to track down what is actually triggering it:

1. Check User-Level Systemd Services

Since you are logged in as shermanchen and the process is owned by you, it might be a user-service rather than a system-service. Your previous command only checked the system level.

Try this:

Bash
systemctl --user list-unit-files | grep -i openclaw

If it appears there, run:

Bash
systemctl --user stop openclaw.service
systemctl --user disable openclaw.service

2. Check for a Crontab "Keep-Alive"

Sometimes scripts are set to run every minute via Cron to make sure they are alive. Check your user crontab:

Bash
crontab -l

Look for any line referencing openclaw or a script that might be starting it.

3. Inspect the Process Parent

To see exactly "who" is responsible for starting that PID 4757, you can look at the process tree. This will tell us if it was started by systemd, screen, tmux, or another script.

Run:

Bash
ps -fjp 4757
  • Look at the PPID (Parent Process ID). * If the PPID is 1, it’s a daemon/systemd.

  • If the PPID leads to something like bash or python, it’s a script loop.

4. Search for the Binary Location

Since you thought you uninstalled it, let's find out exactly where this running version lives:

Bash
ls -l /proc/4757/exe

This will show you the absolute path to the file that is currently running.

5. Check "Lingering" and PM2

If you have ever used PM2 (a common process manager for developers), it might be managing it silently. Check with:

Bash
pm2 list

What to do next:

If the systemctl --user command from Step 1 doesn't find it, please let me know what the PPID and the path from Steps 3 and 4 are. That will give us the smoking gun!

 

Sherman:

shermanchen@serverlenovo:~$ systemctl --user start hermes-gateway.service 
shermanchen@serverlenovo:~$ sudo systemctl --user start signal-daemon.service
Failed to connect to bus: No medium found

 

Gemini:

It looks like you ran into a classic systemd permissions mix-up!

The error Failed to connect to bus: No medium found usually happens when you try to run a user command with sudo. Because sudo switches you to the "root" user, it loses track of your specific user's "bus" (the communication channel for your user-level services).

Here is the quick fix for both services:

1. The Correct Commands

For Hermes, you did it perfectly the first time. For the Signal Daemon, it depends on how it was installed. If it's a system-wide service, you don't use the --user flag.

  • To start Hermes (User level):

    Bash
    systemctl --user start hermes-gateway.service
    
  • To start Signal (System level):

    Bash
    sudo systemctl start signal-daemon.service
    

    (Note: I removed --user here. If you specifically installed Signal as a user service, just run systemctl --user start signal-daemon.service without sudo.)


2. Back to the "Ghost" OpenClaw

Since you are still seeing OpenClaw running on port 18789, let's try one more targeted command to see exactly what is keeping it alive. Run this:

Bash
ps -up 4757

Why this helps:

  • It will show the Command line used to start it.

  • If it says something like python3 openclaw.py or ./openclaw-linux, we’ll know the exact file location.

One other possibility:

Do you use Docker? Sometimes a container is set to restart: always. You can check by running:

docker ps | grep openclaw

If you find the path or the parent process, I can give you the exact command to kill it for good (or at least until you're ready to use it manually). What does that ps -up 4757 output look like?

 

 

01 January 2026

On Ubuntu terminal, how can English text be automatically translated into Chinese with ChatGPT AI?

Here’s how to automatically translate English text into Chinese on an Ubuntu terminal using ChatGPT (OpenAI API) — with simple examples you can run right away.


✅ What You Need First

  1. Ubuntu terminal

  2. OpenAI API Key
    If you don’t have one, create it at https://platform.openai.com/ and copy your key.

  3. Install jq (for JSON in shell)

    sudo apt update
    sudo apt install jq
    
  4. Set your API key in your environment

    export OPENAI_API_KEY="sk-…your key…"
    

🧠 Option A — Bash + curl (Simple & Fast)

You can call the Chat Completions API to translate text.

👉 Create a file called translate.sh:

#!/usr/bin/env bash

text="$1"

if [ -z "$text" ]; then
  echo "Usage: ./translate.sh \"Your English text here\""
  exit 1
fi

response=$(curl -s https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d "{
    \"model\": \"gpt-4o-mini\",
    \"messages\": [
      {\"role\": \"system\", \"content\": \"You are a helpful translator.\"},
      {\"role\": \"user\", \"content\": \"Translate to Chinese: $text\"}
    ],
    \"max_tokens\": 200
  }")

echo "$response" | jq -r '.choices[0].message.content'

Make it executable:

chmod +x translate.sh

Then run:

./translate.sh "Hello, how are you?"

🐍 Option B — Python Script

If you want more flexibility, use Python:

  1. Create translate.py

import os
import openai

openai.api_key = os.getenv("OPENAI_API_KEY")

def translate_to_chinese(text):
    response = openai.ChatCompletion.create(
        model="gpt-4o-mini",
        messages=[
            {"role": "system", "content": "You are a helpful translator."},
            {"role": "user", "content": f"Translate this to Chinese: {text}"}
        ],
        max_tokens=200
    )
    return response.choices[0].message.content

if __name__ == "__main__":
    import sys
    if len(sys.argv) < 2:
        print("Usage: python3 translate.py \"Your English text here\"")
    else:
        print(translate_to_chinese(sys.argv[1]))
  1. Run:

python3 translate.py "This is a test sentence."

🛠 Tips & Enhancements

🔹 Translate a text file

./translate.sh "$(cat input.txt)" > output.txt

🔹 Use other models

  • gpt-4o — highest quality

  • gpt-4o-mini — cheaper & faster

Just replace the "model" field.

🔹 Batch translate multiple lines

Wrap in a loop over lines of a file:

while read line; do
  ./translate.sh "$line"
done < lines.txt

🧩 Notes

  • Using the official OpenAI API avoids web scraping or GUI tools.

  • You pay per token — shorter prompts cost less.

  • The “system” message helps ChatGPT understand the task (translation).


If you want a version that watches a file and auto-translates new text (e.g., with inotifywait), tell me and I can tailor it!


Fix your Ubuntu translate script to use the latest OpenAI API, please.
Thank you.

 

You’re right to ask for this 👍 — the earlier example used the old Chat Completions API, which is now legacy.

Below is a clean, working Ubuntu terminal translation script using the latest OpenAI Responses API (current as of 2025), designed for English → Chinese.

No admin keys, no deprecated endpoints.


✅ Prerequisites (quick check)

sudo apt update
sudo apt install curl jq

Your API key must be set:

export OPENAI_API_KEY=sk-your_real_key_here

Verify:

echo "$OPENAI_API_KEY"

✅ Latest OpenAI API (Responses API) — Bash Script

📄 translate.sh

#!/usr/bin/env bash

# Translate English to Chinese using OpenAI Responses API

if [ -t 0 ] && [ -z "$1" ]; then
  echo "Usage:"
  echo "  ./translate.sh \"Hello world\""
  echo "  echo \"Hello world\" | ./translate.sh"
  exit 1
fi

# Read from argument or stdin
if [ -t 0 ]; then
  INPUT_TEXT="$1"
else
  INPUT_TEXT="$(cat)"
fi

response=$(curl -s https://api.openai.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d "$(jq -n --arg text "$INPUT_TEXT" '{
    model: "gpt-4.1-mini",
    input: [
      {
        role: "system",
        content: [
          { "type": "text", "text": "You are a professional translator. Translate English into Chinese accurately and naturally." }
        ]
      },
      {
        role: "user",
        content: [
          { "type": "text", "text": $text }
        ]
      }
    ]
  }')")

echo "$response" | jq -r '.output_text'

Make executable:

chmod +x translate.sh

✅ How to Use

1️⃣ Translate a sentence

./translate.sh "This is a test."

2️⃣ Translate piped input

echo "Linux is powerful and flexible." | ./translate.sh

3️⃣ Translate a file

./translate.sh "$(cat input.txt)"

or

cat input.txt | ./translate.sh

✅ Why this script is correct & future-proof

✔ Uses /v1/responses (latest API)
✔ No deprecated chat.completions
✔ Proper structured input (role, content, type)
✔ Uses .output_text (recommended aggregation field)
✔ Works with stdin & arguments
✔ Cost-efficient model (gpt-4.1-mini)


🔧 Optional tweaks

🇨🇳 Simplified vs Traditional Chinese

Change the system prompt to:

Translate English into Simplified Chinese.

or

Translate English into Traditional Chinese (Taiwan).

💰 Even cheaper model

model: "gpt-4.1-nano"

🧪 Troubleshooting checklist

IssueFix
401 / invalid_api_keyRe-export key
jq errorsudo apt install jq
Empty outputCheck .output_text
Permission deniedchmod +x translate.sh

If you want next:

  • 🔄 Auto language detection

  • 📁 Batch translate directories

  • ⌨️ Real-time clipboard translation

  • 🔌 Offline fallback (Argos Translate)

Just tell me.

 

31 December 2025

which ai (free of charge) can convert the all kinds of input boxes of a pdf file into fillable and clickable?

For free AI tools that turn PDF input boxes into fillable fields, try
Instafill.ai, PDFgear, or LightPDF, which use AI to automatically detect and add text, checkbox, and signature fields to static PDFs, letting you download them as interactive forms, though some free tiers might have limits. 

Top Free AI Options:
  • Instafill.ai: Uses AI to scan and map form fields (like name, date, signature) onto flat PDFs, creating interactive ones with text, checkboxes, and signature fields automatically.
  • PDFgear: Offers a free online tool to add various form fields (text boxes, checkboxes, signatures) and customize them before downloading the fillable PDF.
  • LightPDF: Provides free online tools, including AI features, to convert and edit PDFs into fillable formats. 

How They Work (General Steps):
  1. Upload: You upload your non-fillable (flat) PDF document to the tool's website.
  2. AI Analysis: The AI scans the PDF, looking for field labels (like "Name," "Email") and layout patterns (underlines, boxes).
  3. Field Insertion: It automatically places interactive fields (text boxes, checkboxes, radio buttons, signature spots) in the right places.
  4. Customize & Download: You can review and adjust the fields (size, type, required status) before downloading your new, ready-to-use fillable PDF. 

While many offer robust free tiers, always check their specific limits on pages or features, as advanced AI functions might require payment. 

23 May 2023

How to convert texts into speech using AI?

 Canadian Accent Generator

 

Tips on how to use Narakeet to create phone greetings https://www.narakeet.com/languages/canadian-accent-text-to-s...

  1. Write a clear phone script: "Thank you for calling the Centre for Immigrant and Community Services. Please note that our offices are closed on Monday, July 3rd, 2023, in observance of Canada Day. All of our offices will open on Tuesday, July 4th. We hope you have a wonderful and joyous celebration, and happy Canada Day!"
  2. Type the script into Narakeet, including all the punctuations and spaces. The system will pause and adjust the greeting accordingly, regardless of the language.
  3. For Mandarin greeting, please type the Chinese greeting and choose the voice: "Zhihan" (芷涵).
  4. For Cantonese greeting, please adjust the wording of the Chinese greeting to make it sound more natural in Cantonese, and then choose the voice "Pak-chi" (柏芝).
  5. For the English greeting, choose Canadian English and then select "Pamela" as the voice.
  6. Note that Narakeet is a free online tool that only allows 20 free greetings. However, this quote resets once the IP address changes.
  7. After downloading all the greetings, you can combine them using Chipchamp. Remember to leave a 0.5-second pause between each greeting.
  8. Finally, export the greeting after reviewing everything to obtain the final audio file.
  9. TIP: ChatGPT is a good tool for reviewing the clarity of the greetings.

 

====================================================

English

https://ttsmaker.com/

==============================================

Mandarin

https://ttsfree.com/text-to-speech/chinese-mandarin-simplified


==============================================

Cantonese

https://ttsfree.com/text-to-speech/chinese-cantonese-traditional

======================

Concatenate Audio files

https://clideo.com/


07 October 2014

How to change colour in Illustrator CS5?

Select the layer. Select the object.
Edit | Edit Colour | Re-colour artwork.
Enter the 3 numbers for H, S, B. OK.
Save it as .ai. Save it as .eps.