From 206f158c7b5c3e7b95a0db6ec82aefcf7476b1d5 Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 21 Jun 2025 00:49:39 +0530 Subject: [PATCH 01/13] Create .keep --- submissions/Terminal_Talks/.keep | 1 + 1 file changed, 1 insertion(+) create mode 100644 submissions/Terminal_Talks/.keep diff --git a/submissions/Terminal_Talks/.keep b/submissions/Terminal_Talks/.keep new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/submissions/Terminal_Talks/.keep @@ -0,0 +1 @@ + From efcf4297969ead520d294fbad4f192acf07e0214 Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 21 Jun 2025 00:50:32 +0530 Subject: [PATCH 02/13] Add files via upload --- submissions/Terminal_Talks/install.sh | 37 ++++++++++++ submissions/Terminal_Talks/readme.md | 13 +++++ submissions/Terminal_Talks/requirements.txt | 12 ++++ submissions/Terminal_Talks/terminal-talks | 64 +++++++++++++++++++++ 4 files changed, 126 insertions(+) create mode 100644 submissions/Terminal_Talks/install.sh create mode 100644 submissions/Terminal_Talks/readme.md create mode 100644 submissions/Terminal_Talks/requirements.txt create mode 100644 submissions/Terminal_Talks/terminal-talks diff --git a/submissions/Terminal_Talks/install.sh b/submissions/Terminal_Talks/install.sh new file mode 100644 index 00000000..5e487652 --- /dev/null +++ b/submissions/Terminal_Talks/install.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +echo "๐Ÿ“ฆ Installing Terminal Talks..." + +# Install Python dependencies +echo "๐Ÿ”ง Installing Python dependencies..." +python3 -m pip install --user -r requirements.txt + +# Define install target +TARGET="$HOME/.local/bin" +CMD_NAME="terminal-talks" + +# Create directory if it doesn't exist +mkdir -p "$TARGET" + +# Copy executable +if cp terminal-talks "$TARGET/$CMD_NAME"; then + chmod +x "$TARGET/$CMD_NAME" + echo "โœ… Installed to $TARGET/$CMD_NAME" +else + echo "โŒ Failed to copy script to $TARGET" + echo "Please try manually:" + echo " sudo cp terminal-talks /usr/local/bin/$CMD_NAME" + echo " sudo chmod +x /usr/local/bin/$CMD_NAME" + exit 1 +fi + +# Check if $TARGET is in PATH +if ! echo "$PATH" | grep -q "$TARGET"; then + echo "" + echo "โš ๏ธ $TARGET is not in your PATH." + echo "Add this line to your ~/.bashrc or ~/.zshrc:" + echo 'export PATH="$HOME/.local/bin:$PATH"' +else + echo "๐Ÿš€ You can now run the tool using:" + echo " terminal-talks" +fi diff --git a/submissions/Terminal_Talks/readme.md b/submissions/Terminal_Talks/readme.md new file mode 100644 index 00000000..d983844d --- /dev/null +++ b/submissions/Terminal_Talks/readme.md @@ -0,0 +1,13 @@ +# Terminal Talks ๐ŸŽ™๏ธ๐Ÿ’ป + +**Terminal Talks** is an offline voice-to-terminal helper that listens to simple spoken phrases like โ€œlist filesโ€ or โ€œmake directoryโ€ and suggests the correct Linux command to use. + +## ๐ŸŒŸ Features + +- ๐Ÿ—ฃ๏ธ Offline speech recognition using Vosk (Indian English model) +- ๐Ÿ’ก Smart phrase-to-command suggestions (like `ls`, `mkdir`, `cd ..`) +- ๐Ÿ–ฅ๏ธ Lightweight, runs without internet +- ๐Ÿ› ๏ธ Simple terminal interface +- ๐Ÿ”’ No external API calls or cloud processing + +> Built for Hack Club's TerminalCraft โ€” made to help new users discover the terminal in a friendly way. diff --git a/submissions/Terminal_Talks/requirements.txt b/submissions/Terminal_Talks/requirements.txt new file mode 100644 index 00000000..e4b844c8 --- /dev/null +++ b/submissions/Terminal_Talks/requirements.txt @@ -0,0 +1,12 @@ +certifi==2025.6.15 +cffi==1.17.1 +charset-normalizer==3.4.2 +idna==3.10 +pycparser==2.22 +requests==2.32.4 +sounddevice==0.5.2 +srt==3.5.3 +tqdm==4.67.1 +urllib3==2.5.0 +vosk==0.3.45 +websockets==15.0.1 diff --git a/submissions/Terminal_Talks/terminal-talks b/submissions/Terminal_Talks/terminal-talks new file mode 100644 index 00000000..31a8d5d7 --- /dev/null +++ b/submissions/Terminal_Talks/terminal-talks @@ -0,0 +1,64 @@ +#!/usr/bin/env python3 + +import os +import queue +import sounddevice as sd +import vosk +import sys +import json + +MODEL_PATH = os.path.join(os.path.dirname(__file__), "model") + +if not os.path.exists(MODEL_PATH): + print("โŒ Vosk model not found in ./model") + sys.exit(1) + +model = vosk.Model(MODEL_PATH) +q = queue.Queue() + +command_map = { + "list files": "ls", + "make directory": "mkdir ", + "go to downloads": "cd ~/Downloads", + "show hidden files": "ls -a", + "remove file": "rm ", + "check ip address": "ip a", + "go back": "cd ..", + "list everything": "ls -l", + "clear screen": "clear", + "check python version": "python3 --version" +} + +def callback(indata, frames, time, status): + if status: + print("[!] Mic status:", status, file=sys.stderr) + q.put(bytes(indata)) + +def recognize(): + print("๐ŸŽ™๏ธ Speak now (Ctrl+C to stop)...") + with sd.RawInputStream(samplerate=16000, blocksize=8000, dtype='int16', + channels=1, callback=callback): + rec = vosk.KaldiRecognizer(model, 16000) + while True: + data = q.get() + if rec.AcceptWaveform(data): + result = json.loads(rec.Result()) + return result.get("text", "") + +def main(): + try: + text = recognize() + print(f"๐Ÿ“ You said: {text}") + spoken = text.strip().lower() + if spoken in command_map: + print(f"\n๐Ÿ’ก Suitable command for this action is:\nโ†’ {command_map[spoken]}") + else: + print("\nโš ๏ธ No matching command found.") + print("Try saying something like 'list files' or 'show hidden files'.") + except KeyboardInterrupt: + print("\n๐Ÿ‘‹ Exiting Terminal Talks.") + except Exception as e: + print("โŒ Error:", e) + +if __name__ == "__main__": + main() From 603e96a19ae4f329da8f35bdc91502767eb7e245 Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 21 Jun 2025 00:59:00 +0530 Subject: [PATCH 03/13] Update readme.md --- submissions/Terminal_Talks/readme.md | 117 ++++++++++++++++++++++++--- 1 file changed, 108 insertions(+), 9 deletions(-) diff --git a/submissions/Terminal_Talks/readme.md b/submissions/Terminal_Talks/readme.md index d983844d..d4c85a28 100644 --- a/submissions/Terminal_Talks/readme.md +++ b/submissions/Terminal_Talks/readme.md @@ -1,13 +1,112 @@ -# Terminal Talks ๐ŸŽ™๏ธ๐Ÿ’ป +# TerminalTalks -**Terminal Talks** is an offline voice-to-terminal helper that listens to simple spoken phrases like โ€œlist filesโ€ or โ€œmake directoryโ€ and suggests the correct Linux command to use. +TerminalTalks is an offline, voice-powered command suggestion tool for Linux. Speak natural phrases like โ€œlist filesโ€ or โ€œcheck IP,โ€ and it will suggest the appropriate terminal command, such as `ls` or `ip a`. Designed for quick use, it's especially helpful for those who forget common commands or want to explore Linux hands-free. -## ๐ŸŒŸ Features +------------------------------------------------------------ -- ๐Ÿ—ฃ๏ธ Offline speech recognition using Vosk (Indian English model) -- ๐Ÿ’ก Smart phrase-to-command suggestions (like `ls`, `mkdir`, `cd ..`) -- ๐Ÿ–ฅ๏ธ Lightweight, runs without internet -- ๐Ÿ› ๏ธ Simple terminal interface -- ๐Ÿ”’ No external API calls or cloud processing +FEATURES -> Built for Hack Club's TerminalCraft โ€” made to help new users discover the terminal in a friendly way. +- Works completely offline (no internet required after setup) +- Supports Indian English accent using Vosk STT model +- Maps speech to 150+ common Linux commands +- Simple one-command install script +- Easy to modify and expand command set +- Beginner-friendly, works on most Linux systems + +------------------------------------------------------------ + +HOW IT WORKS + +1. You run the command `terminal-talks` from any terminal. +2. It starts listening to your voice using the default microphone. +3. Speech is transcribed locally using the Vosk model. +4. It searches for a matching command in its mapping dictionary. +5. The best-matching Linux command is shown as output. +6. You can copy and run it manually. + +Example: + +You say: โ€œlist all filesโ€ +It shows: Suggested command: `ls -a` + +------------------------------------------------------------ + +INSTALLATION + +NOTE: Before installing, you must manually download the offline model due to file size. + +STEP 1 โ€” Download the Speech Recognition Model: + +- Visit: https://alphacephei.com/vosk/models +- Download: vosk-model-en-in-0.51 +- Extract the folder +- Rename the folder to: model +- Move this folder into the TerminalTalks project directory + +Your final folder structure should look like: + +TerminalTalks/ +โ”œโ”€โ”€ install.sh +โ”œโ”€โ”€ terminal-talks +โ”œโ”€โ”€ requirements.txt +โ”œโ”€โ”€ README.md +โ””โ”€โ”€ model/ + โ””โ”€โ”€ vosk files... + +STEP 2 โ€” Run the Install Script: + +Make sure you're inside the `TerminalTalks` folder: + +```bash +chmod +x install.sh +./install.sh +``` +What this does: + +Installs all Python packages listed in requirements.txt +Creates a global command terminal-talks accessible from any directory + +STEP 3 โ€” Use the Tool: + +After installation: + +terminal-talks + +Say something like โ€œmake a folderโ€It shows: Suggested command: mkdir + +EXAMPLES OF SUPPORTED COMMANDS + +You Say โ†’ Suggested Command + +"list files" โ†’ ls"show all files" โ†’ ls -a"make a folder" โ†’ mkdir"remove a directory" โ†’ rm -r"check IP address" โ†’ ip a"whatโ€™s my current path" โ†’ pwd"clear the screen" โ†’ clear"view running processes" โ†’ top + +More than 150 phrases are supported. + +REQUIREMENTS + +Python 3.7+ + +Linux-based system (Ubuntu, Arch, Debian, etc.) + +Working microphone input + +~1 GB free space for the speech model + +TESTED ON + +Ubuntu 22.04 โœ… + +Arch Linux โœ… + +Debian 12 โœ… + +Tested by 3 users on various machines. + +BUILT FOR + +This project was built for Hack Clubโ€™s TerminalCrafthttps://terminalcraft.hackclub.dev + + +CONTACT + +Created by Sameer KulhariGitHub: https://github.com/sameer-kulhariRepository: https://github.com/sameer-kulhari/TerminalTalks From 180471acdb1c6fb44dea097c00361f2649575a38 Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 21 Jun 2025 01:07:30 +0530 Subject: [PATCH 04/13] Update readme.md --- submissions/Terminal_Talks/readme.md | 171 +++++++++++---------------- 1 file changed, 67 insertions(+), 104 deletions(-) diff --git a/submissions/Terminal_Talks/readme.md b/submissions/Terminal_Talks/readme.md index d4c85a28..f092aa12 100644 --- a/submissions/Terminal_Talks/readme.md +++ b/submissions/Terminal_Talks/readme.md @@ -1,112 +1,75 @@ -# TerminalTalks - -TerminalTalks is an offline, voice-powered command suggestion tool for Linux. Speak natural phrases like โ€œlist filesโ€ or โ€œcheck IP,โ€ and it will suggest the appropriate terminal command, such as `ls` or `ip a`. Designed for quick use, it's especially helpful for those who forget common commands or want to explore Linux hands-free. - ------------------------------------------------------------- - -FEATURES - -- Works completely offline (no internet required after setup) -- Supports Indian English accent using Vosk STT model -- Maps speech to 150+ common Linux commands -- Simple one-command install script -- Easy to modify and expand command set -- Beginner-friendly, works on most Linux systems - ------------------------------------------------------------- - -HOW IT WORKS - -1. You run the command `terminal-talks` from any terminal. -2. It starts listening to your voice using the default microphone. -3. Speech is transcribed locally using the Vosk model. -4. It searches for a matching command in its mapping dictionary. -5. The best-matching Linux command is shown as output. -6. You can copy and run it manually. - -Example: - -You say: โ€œlist all filesโ€ -It shows: Suggested command: `ls -a` - ------------------------------------------------------------- - -INSTALLATION - -NOTE: Before installing, you must manually download the offline model due to file size. - -STEP 1 โ€” Download the Speech Recognition Model: - -- Visit: https://alphacephei.com/vosk/models -- Download: vosk-model-en-in-0.51 -- Extract the folder -- Rename the folder to: model -- Move this folder into the TerminalTalks project directory - -Your final folder structure should look like: - -TerminalTalks/ -โ”œโ”€โ”€ install.sh -โ”œโ”€โ”€ terminal-talks -โ”œโ”€โ”€ requirements.txt -โ”œโ”€โ”€ README.md -โ””โ”€โ”€ model/ - โ””โ”€โ”€ vosk files... - -STEP 2 โ€” Run the Install Script: - -Make sure you're inside the `TerminalTalks` folder: - -```bash -chmod +x install.sh +# TerminalTalks ๐ŸŽ™๏ธ๐Ÿ’ป +TerminalTalks is an **offline, voice-powered command suggestion tool** for Linux. Speak natural phrases like _"list files"_ or _"check IP,"_ and it will suggest the appropriate terminal command like `ls` or `ip a`. Perfect for when you forget commands or want hands-free Linux exploration! + +## โœจ Features +- ๐Ÿ›œ **Works completely offline** (no internet required after setup) +- ๐Ÿ‡ฎ๐Ÿ‡ณ Supports **Indian English accent** using Vosk STT model +- ๐Ÿ“‹ Maps speech to **150+ common Linux commands** +- โšก **Simple one-command install** script +- ๐Ÿ”ง Easy to modify and expand command set +- ๐Ÿง Beginner-friendly, works on most Linux systems + +## ๐Ÿ› ๏ธ How It Works +1. Run `terminal-talks` from any terminal +2. It starts listening to your voice ๐ŸŽค +3. Speech is transcribed locally using Vosk +4. Searches for matching command in its dictionary +5. Shows the best Linux command match +6. Copy and run it manually + +**Example:** +๐ŸŽค You say: _"list all files"_ +๐Ÿ’ป It shows: `Suggested command: ls -a` + +## ๐Ÿ“ฅ Installation +> **Note:** Before installing, you must manually download the offline model due to file size. + +### Step 1 โ€” Download Speech Recognition Model +1. Visit: [https://alphacephei.com/vosk/models](https://alphacephei.com/vosk/models) +2. Download: `vosk-model-en-in-0.51` +3. Extract and rename folder to `model` +4. Place in TerminalTalks project directory + +### Step 2 โ€” Run Install Script +```bash +chmod +x install.sh ./install.sh ``` -What this does: - -Installs all Python packages listed in requirements.txt -Creates a global command terminal-talks accessible from any directory - -STEP 3 โ€” Use the Tool: - -After installation: - -terminal-talks - -Say something like โ€œmake a folderโ€It shows: Suggested command: mkdir - -EXAMPLES OF SUPPORTED COMMANDS - -You Say โ†’ Suggested Command - -"list files" โ†’ ls"show all files" โ†’ ls -a"make a folder" โ†’ mkdir"remove a directory" โ†’ rm -r"check IP address" โ†’ ip a"whatโ€™s my current path" โ†’ pwd"clear the screen" โ†’ clear"view running processes" โ†’ top - -More than 150 phrases are supported. - -REQUIREMENTS - -Python 3.7+ - -Linux-based system (Ubuntu, Arch, Debian, etc.) - -Working microphone input - -~1 GB free space for the speech model - -TESTED ON - +Step 3 โ€” Use the Tool +```bash +terminal-talks +``` +Try saying: "make a folder" โ†’ Shows: Suggested command: mkdir + +๐Ÿ“š Example Commands +You Say Suggested Command +"list files" ls +"show all files" ls -a +"make a folder" mkdir +"remove a directory" rm -r +"check IP address" ip a +"what's my current path" pwd +"clear the screen" clear +"view running processes" top +Over 150 phrases supported! + +## โš™๏ธ Requirements +---Python 3.7+ +---Linux-based system (Ubuntu, Arch, Debian, etc.) +---Working microphone + +~1 GB free space for model + +## โœ”๏ธ Tested On Ubuntu 22.04 โœ… - Arch Linux โœ… - Debian 12 โœ… -Tested by 3 users on various machines. - -BUILT FOR - -This project was built for Hack Clubโ€™s TerminalCrafthttps://terminalcraft.hackclub.dev - +## ๐Ÿš€ Built For +This project was built for Hack Club's TerminalCraft ๐Ÿ› ๏ธ -CONTACT +## ๐Ÿ“ฌ Contact +Created by Sameer Kulhari +GitHub | Repository -Created by Sameer KulhariGitHub: https://github.com/sameer-kulhariRepository: https://github.com/sameer-kulhari/TerminalTalks +๐Ÿ’ก Pro Tip: Add your own custom commands by editing the mapping dictionary! From 1664cdef10ca62b2f3bc7e5e9ddcc2e925eef732 Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 21 Jun 2025 01:10:50 +0530 Subject: [PATCH 05/13] Update readme.md --- submissions/Terminal_Talks/readme.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/submissions/Terminal_Talks/readme.md b/submissions/Terminal_Talks/readme.md index f092aa12..d26dac36 100644 --- a/submissions/Terminal_Talks/readme.md +++ b/submissions/Terminal_Talks/readme.md @@ -41,16 +41,16 @@ terminal-talks ``` Try saying: "make a folder" โ†’ Shows: Suggested command: mkdir -๐Ÿ“š Example Commands +## ๐Ÿ“š Example Commands You Say Suggested Command -"list files" ls -"show all files" ls -a -"make a folder" mkdir -"remove a directory" rm -r -"check IP address" ip a -"what's my current path" pwd -"clear the screen" clear -"view running processes" top + "list files" = ls + "show all files" = ls -a + "make a folder" = mkdir + "remove a directory" = rm -r + "check IP address" = ip a + "what's my current path" = pwd + "clear the screen" = clear + "view running processes" = top Over 150 phrases supported! ## โš™๏ธ Requirements @@ -70,6 +70,6 @@ This project was built for Hack Club's TerminalCraft ๐Ÿ› ๏ธ ## ๐Ÿ“ฌ Contact Created by Sameer Kulhari -GitHub | Repository +GitHub Repository : https://github.com/Sameer-Kulhari/TerminalTalks ๐Ÿ’ก Pro Tip: Add your own custom commands by editing the mapping dictionary! From 98e70e63d32dfcb5d34ba171dbdac06b94355775 Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 21 Jun 2025 01:13:32 +0530 Subject: [PATCH 06/13] Update readme.md --- submissions/Terminal_Talks/readme.md | 39 +++++++++++++++------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/submissions/Terminal_Talks/readme.md b/submissions/Terminal_Talks/readme.md index d26dac36..2c35f5bf 100644 --- a/submissions/Terminal_Talks/readme.md +++ b/submissions/Terminal_Talks/readme.md @@ -1,4 +1,4 @@ -# TerminalTalks ๐ŸŽ™๏ธ๐Ÿ’ป +# ๐Ÿ’ป๐ŸŽ™๏ธ TerminalTalks ๐ŸŽ™๏ธ๐Ÿ’ป TerminalTalks is an **offline, voice-powered command suggestion tool** for Linux. Speak natural phrases like _"list files"_ or _"check IP,"_ and it will suggest the appropriate terminal command like `ls` or `ip a`. Perfect for when you forget commands or want hands-free Linux exploration! ## โœจ Features @@ -42,29 +42,32 @@ terminal-talks Try saying: "make a folder" โ†’ Shows: Suggested command: mkdir ## ๐Ÿ“š Example Commands -You Say Suggested Command - "list files" = ls - "show all files" = ls -a - "make a folder" = mkdir - "remove a directory" = rm -r - "check IP address" = ip a - "what's my current path" = pwd - "clear the screen" = clear - "view running processes" = top -Over 150 phrases supported! + +| You Say | Suggested Command | +|------------------------------|--------------------| +| "list files" | `ls` | +| "show all files" | `ls -a` | +| "make a folder" | `mkdir` | +| "remove a directory" | `rm -r` | +| "check IP address" | `ip a` | +| "what's my current path" | `pwd` | +| "clear the screen" | `clear` | +| "view running processes" | `top` | + +*Over 150 phrases supported!* ## โš™๏ธ Requirements ----Python 3.7+ ----Linux-based system (Ubuntu, Arch, Debian, etc.) ----Working microphone -~1 GB free space for model +- Python 3.7+ +- Linux-based system (Ubuntu, Arch, Debian, etc.) +- Working microphone +- ~1 GB free space for model ## โœ”๏ธ Tested On -Ubuntu 22.04 โœ… -Arch Linux โœ… -Debian 12 โœ… +- Ubuntu 22.04 โœ… +- Arch Linux โœ… +- Debian 12 โœ… ## ๐Ÿš€ Built For This project was built for Hack Club's TerminalCraft ๐Ÿ› ๏ธ From c3720df2ae64b815a0c494d9c3633991940d1c33 Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 21 Jun 2025 01:14:23 +0530 Subject: [PATCH 07/13] Update readme.md --- submissions/Terminal_Talks/readme.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/submissions/Terminal_Talks/readme.md b/submissions/Terminal_Talks/readme.md index 2c35f5bf..9425dbac 100644 --- a/submissions/Terminal_Talks/readme.md +++ b/submissions/Terminal_Talks/readme.md @@ -1,4 +1,5 @@ -# ๐Ÿ’ป๐ŸŽ™๏ธ TerminalTalks ๐ŸŽ™๏ธ๐Ÿ’ป +# ------------------------------๐Ÿ’ป๐ŸŽ™๏ธ TerminalTalks ๐ŸŽ™๏ธ๐Ÿ’ป -------------------------------------- + TerminalTalks is an **offline, voice-powered command suggestion tool** for Linux. Speak natural phrases like _"list files"_ or _"check IP,"_ and it will suggest the appropriate terminal command like `ls` or `ip a`. Perfect for when you forget commands or want hands-free Linux exploration! ## โœจ Features From 809e59dce347787e165ca2f76ce7f5020fc2aa39 Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 21 Jun 2025 01:15:15 +0530 Subject: [PATCH 08/13] Update readme.md --- submissions/Terminal_Talks/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submissions/Terminal_Talks/readme.md b/submissions/Terminal_Talks/readme.md index 9425dbac..ac47f796 100644 --- a/submissions/Terminal_Talks/readme.md +++ b/submissions/Terminal_Talks/readme.md @@ -1,4 +1,4 @@ -# ------------------------------๐Ÿ’ป๐ŸŽ™๏ธ TerminalTalks ๐ŸŽ™๏ธ๐Ÿ’ป -------------------------------------- +# ----------------------------๐Ÿ’ป๐ŸŽ™๏ธ TerminalTalks ๐ŸŽ™๏ธ๐Ÿ’ป ------------------------------ TerminalTalks is an **offline, voice-powered command suggestion tool** for Linux. Speak natural phrases like _"list files"_ or _"check IP,"_ and it will suggest the appropriate terminal command like `ls` or `ip a`. Perfect for when you forget commands or want hands-free Linux exploration! From 7e271c74b272b5e77cb9e72f185df95dc4262ca7 Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 21 Jun 2025 01:15:33 +0530 Subject: [PATCH 09/13] Update readme.md --- submissions/Terminal_Talks/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submissions/Terminal_Talks/readme.md b/submissions/Terminal_Talks/readme.md index ac47f796..3c37b6b3 100644 --- a/submissions/Terminal_Talks/readme.md +++ b/submissions/Terminal_Talks/readme.md @@ -1,4 +1,4 @@ -# ----------------------------๐Ÿ’ป๐ŸŽ™๏ธ TerminalTalks ๐ŸŽ™๏ธ๐Ÿ’ป ------------------------------ +# -------------------------๐Ÿ’ป๐ŸŽ™๏ธ TerminalTalks ๐ŸŽ™๏ธ๐Ÿ’ป -------------------------- TerminalTalks is an **offline, voice-powered command suggestion tool** for Linux. Speak natural phrases like _"list files"_ or _"check IP,"_ and it will suggest the appropriate terminal command like `ls` or `ip a`. Perfect for when you forget commands or want hands-free Linux exploration! From 36c893b8d20ba6905ecfa405984f239c1c6357c2 Mon Sep 17 00:00:00 2001 From: Sameer Date: Sat, 21 Jun 2025 01:16:23 +0530 Subject: [PATCH 10/13] Delete submissions/Terminal_Talks/.keep --- submissions/Terminal_Talks/.keep | 1 - 1 file changed, 1 deletion(-) delete mode 100644 submissions/Terminal_Talks/.keep diff --git a/submissions/Terminal_Talks/.keep b/submissions/Terminal_Talks/.keep deleted file mode 100644 index 8b137891..00000000 --- a/submissions/Terminal_Talks/.keep +++ /dev/null @@ -1 +0,0 @@ - From d99a1117ac28c54003990dd78502c82e461fcb8a Mon Sep 17 00:00:00 2001 From: Sameer Date: Wed, 25 Jun 2025 13:28:13 +0000 Subject: [PATCH 11/13] new man-db full support --- submissions/Terminal_Talks/install.sh | 17 +++--- submissions/Terminal_Talks/terminal-talks | 69 ++++++++++++----------- 2 files changed, 46 insertions(+), 40 deletions(-) diff --git a/submissions/Terminal_Talks/install.sh b/submissions/Terminal_Talks/install.sh index 5e487652..99366f57 100644 --- a/submissions/Terminal_Talks/install.sh +++ b/submissions/Terminal_Talks/install.sh @@ -2,18 +2,18 @@ echo "๐Ÿ“ฆ Installing Terminal Talks..." -# Install Python dependencies -echo "๐Ÿ”ง Installing Python dependencies..." -python3 -m pip install --user -r requirements.txt +# Install Python dependencies forcefully +echo "๐Ÿ”ง Installing Python dependencies " +python3 -m pip install --user --break-system-packages --force-reinstall -r requirements.txt # Define install target TARGET="$HOME/.local/bin" CMD_NAME="terminal-talks" -# Create directory if it doesn't exist +# Create target directory if needed mkdir -p "$TARGET" -# Copy executable +# Copy script if cp terminal-talks "$TARGET/$CMD_NAME"; then chmod +x "$TARGET/$CMD_NAME" echo "โœ… Installed to $TARGET/$CMD_NAME" @@ -25,13 +25,14 @@ else exit 1 fi -# Check if $TARGET is in PATH +# Warn if not in PATH if ! echo "$PATH" | grep -q "$TARGET"; then echo "" echo "โš ๏ธ $TARGET is not in your PATH." echo "Add this line to your ~/.bashrc or ~/.zshrc:" echo 'export PATH="$HOME/.local/bin:$PATH"' + echo "Then run: source ~/.bashrc" else - echo "๐Ÿš€ You can now run the tool using:" - echo " terminal-talks" + echo "๐Ÿš€ You can now run the tool by typing:" + echo " $CMD_NAME" fi diff --git a/submissions/Terminal_Talks/terminal-talks b/submissions/Terminal_Talks/terminal-talks index 31a8d5d7..686b4663 100644 --- a/submissions/Terminal_Talks/terminal-talks +++ b/submissions/Terminal_Talks/terminal-talks @@ -1,64 +1,69 @@ #!/usr/bin/env python3 import os +os.environ["VOSK_LOG_LEVEL"] = "-1" # Vosk logs + import queue import sounddevice as sd import vosk import sys +import subprocess import json -MODEL_PATH = os.path.join(os.path.dirname(__file__), "model") - +# Model path +MODEL_PATH = "model" if not os.path.exists(MODEL_PATH): - print("โŒ Vosk model not found in ./model") + print(f"โ— Model not found at {MODEL_PATH}") sys.exit(1) model = vosk.Model(MODEL_PATH) q = queue.Queue() -command_map = { - "list files": "ls", - "make directory": "mkdir ", - "go to downloads": "cd ~/Downloads", - "show hidden files": "ls -a", - "remove file": "rm ", - "check ip address": "ip a", - "go back": "cd ..", - "list everything": "ls -l", - "clear screen": "clear", - "check python version": "python3 --version" -} - def callback(indata, frames, time, status): if status: - print("[!] Mic status:", status, file=sys.stderr) + print(status, file=sys.stderr) q.put(bytes(indata)) -def recognize(): - print("๐ŸŽ™๏ธ Speak now (Ctrl+C to stop)...") +def get_speech(): with sd.RawInputStream(samplerate=16000, blocksize=8000, dtype='int16', channels=1, callback=callback): + print("๐ŸŽค Speak now (press Ctrl+C to stop)...") rec = vosk.KaldiRecognizer(model, 16000) + while True: data = q.get() if rec.AcceptWaveform(data): result = json.loads(rec.Result()) return result.get("text", "") -def main(): +def query_man_db(query): try: - text = recognize() - print(f"๐Ÿ“ You said: {text}") - spoken = text.strip().lower() - if spoken in command_map: - print(f"\n๐Ÿ’ก Suitable command for this action is:\nโ†’ {command_map[spoken]}") - else: - print("\nโš ๏ธ No matching command found.") - print("Try saying something like 'list files' or 'show hidden files'.") - except KeyboardInterrupt: - print("\n๐Ÿ‘‹ Exiting Terminal Talks.") + result = subprocess.run(["man", "-k", query], capture_output=True, text=True) + lines = result.stdout.strip().split('\n') + + if not lines or lines[0].strip() == "": + return "โŒ No matching commands found in man pages." + + # Collect suggestions + suggestions = ["โœ… Suggestions:"] + for line in lines[:10]: # Top 10 only + parts = line.split(" - ", 1) + if len(parts) == 2: + cmd_info = parts[0].strip() + description = parts[1].strip() + suggestions.append(f"- {cmd_info}: {description}") + else: + suggestions.append(f"- {line.strip()}") + return "\n".join(suggestions) + except Exception as e: - print("โŒ Error:", e) + return f"\nโš ๏ธ Error querying man: {e}" +# --- MAIN --- if __name__ == "__main__": - main() + try: + text = get_speech() + print(f"\n๐Ÿ“ You said: {text}") + print(query_man_db(text)) + except KeyboardInterrupt: + print("\n๐Ÿ‘‹ Exiting.") From 1cf8ec6653a2daeed3a352a93bd69b0ae0ca1242 Mon Sep 17 00:00:00 2001 From: Sameer Kulhari Date: Mon, 30 Jun 2025 23:27:33 +0530 Subject: [PATCH 12/13] Added link to github repo --- submissions/Terminal_Talks/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submissions/Terminal_Talks/readme.md b/submissions/Terminal_Talks/readme.md index 3c37b6b3..11c68c9d 100644 --- a/submissions/Terminal_Talks/readme.md +++ b/submissions/Terminal_Talks/readme.md @@ -74,6 +74,6 @@ This project was built for Hack Club's TerminalCraft ๐Ÿ› ๏ธ ## ๐Ÿ“ฌ Contact Created by Sameer Kulhari -GitHub Repository : https://github.com/Sameer-Kulhari/TerminalTalks +GitHub Repository : https://github.com/Sameer-Kulhari/Terminal_Talks ๐Ÿ’ก Pro Tip: Add your own custom commands by editing the mapping dictionary! From 8735e1cee5b4f3cae6bb71e6e1a3d1dff07f0fb9 Mon Sep 17 00:00:00 2001 From: Sameer Kulhari Date: Tue, 1 Jul 2025 00:34:05 +0530 Subject: [PATCH 13/13] Added themes to the terminal --- submissions/Terminal_Talks/install.sh | 0 submissions/Terminal_Talks/readme.md | 1 + submissions/Terminal_Talks/scripts/matrix.sh | 9 +++ submissions/Terminal_Talks/terminal-talks | 82 +++++++++++++++----- submissions/Terminal_Talks/themes/dark.sh | 7 ++ submissions/Terminal_Talks/themes/hacker.sh | 7 ++ submissions/Terminal_Talks/themes/light.sh | 7 ++ 7 files changed, 94 insertions(+), 19 deletions(-) mode change 100644 => 100755 submissions/Terminal_Talks/install.sh create mode 100755 submissions/Terminal_Talks/scripts/matrix.sh mode change 100644 => 100755 submissions/Terminal_Talks/terminal-talks create mode 100755 submissions/Terminal_Talks/themes/dark.sh create mode 100755 submissions/Terminal_Talks/themes/hacker.sh create mode 100755 submissions/Terminal_Talks/themes/light.sh diff --git a/submissions/Terminal_Talks/install.sh b/submissions/Terminal_Talks/install.sh old mode 100644 new mode 100755 diff --git a/submissions/Terminal_Talks/readme.md b/submissions/Terminal_Talks/readme.md index 11c68c9d..0f960563 100644 --- a/submissions/Terminal_Talks/readme.md +++ b/submissions/Terminal_Talks/readme.md @@ -9,6 +9,7 @@ TerminalTalks is an **offline, voice-powered command suggestion tool** for Linux - โšก **Simple one-command install** script - ๐Ÿ”ง Easy to modify and expand command set - ๐Ÿง Beginner-friendly, works on most Linux systems +- Supports theme switching ## ๐Ÿ› ๏ธ How It Works 1. Run `terminal-talks` from any terminal diff --git a/submissions/Terminal_Talks/scripts/matrix.sh b/submissions/Terminal_Talks/scripts/matrix.sh new file mode 100755 index 00000000..c09e4167 --- /dev/null +++ b/submissions/Terminal_Talks/scripts/matrix.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# scripts/matrix.sh + +echo "๐Ÿ’ป Entering Matrix mode..." +echo -e "\e[1;40m" +tr -c "[:alnum:]" "A" < /dev/urandom | head -c 10000 | fold -w 80 | while read line; do + echo -e "\e[32m$line\e[0m" + sleep 0.05 +done diff --git a/submissions/Terminal_Talks/terminal-talks b/submissions/Terminal_Talks/terminal-talks old mode 100644 new mode 100755 index 686b4663..465c9b03 --- a/submissions/Terminal_Talks/terminal-talks +++ b/submissions/Terminal_Talks/terminal-talks @@ -1,8 +1,6 @@ #!/usr/bin/env python3 import os -os.environ["VOSK_LOG_LEVEL"] = "-1" # Vosk logs - import queue import sounddevice as sd import vosk @@ -10,21 +8,44 @@ import sys import subprocess import json -# Model path -MODEL_PATH = "model" -if not os.path.exists(MODEL_PATH): - print(f"โ— Model not found at {MODEL_PATH}") - sys.exit(1) +# Hide Vosk logging +os.environ["VOSK_LOG_LEVEL"] = "-1" + +# ==== THEME SELECTOR ==== + +def select_theme(): + print("\n๐ŸŽจ Choose a Terminal Theme:") + print("1. Dark") + print("2. Light") + print("3. Hacker (Matrix-style green)") + + choice = input("Enter your choice (1/2/3): ").strip() + theme_scripts = { + "1": "themes/dark.sh", + "2": "themes/light.sh", + "3": "themes/hacker.sh" + } + + if choice in theme_scripts: + subprocess.run(["bash", theme_scripts[choice]]) + else: + print("โŒ Invalid choice.") + +# ==== MATRIX MODE ==== + +def enter_matrix_mode(): + subprocess.run(["bash", "scripts/matrix.sh"]) + +# ==== SPEECH RECOGNITION ==== -model = vosk.Model(MODEL_PATH) -q = queue.Queue() +def get_speech(model): + q = queue.Queue() -def callback(indata, frames, time, status): - if status: - print(status, file=sys.stderr) - q.put(bytes(indata)) + def callback(indata, frames, time, status): + if status: + print(status, file=sys.stderr) + q.put(bytes(indata)) -def get_speech(): with sd.RawInputStream(samplerate=16000, blocksize=8000, dtype='int16', channels=1, callback=callback): print("๐ŸŽค Speak now (press Ctrl+C to stop)...") @@ -36,6 +57,8 @@ def get_speech(): result = json.loads(rec.Result()) return result.get("text", "") +# ==== MAN PAGE QUERY ==== + def query_man_db(query): try: result = subprocess.run(["man", "-k", query], capture_output=True, text=True) @@ -44,9 +67,8 @@ def query_man_db(query): if not lines or lines[0].strip() == "": return "โŒ No matching commands found in man pages." - # Collect suggestions suggestions = ["โœ… Suggestions:"] - for line in lines[:10]: # Top 10 only + for line in lines[:10]: # Limit to top 10 parts = line.split(" - ", 1) if len(parts) == 2: cmd_info = parts[0].strip() @@ -59,11 +81,33 @@ def query_man_db(query): except Exception as e: return f"\nโš ๏ธ Error querying man: {e}" -# --- MAIN --- -if __name__ == "__main__": +# ==== MAIN PROGRAM ==== + +def run_main(): + MODEL_PATH = "model" + if not os.path.exists(MODEL_PATH): + print(f"โ— Model not found at: {MODEL_PATH}") + sys.exit(1) + + model = vosk.Model(MODEL_PATH) try: - text = get_speech() + text = get_speech(model) print(f"\n๐Ÿ“ You said: {text}") print(query_man_db(text)) except KeyboardInterrupt: print("\n๐Ÿ‘‹ Exiting.") + +# ==== ENTRY POINT ==== + +if __name__ == "__main__": + if len(sys.argv) > 1: + cmd = sys.argv[1].lower() + if cmd == "theme": + select_theme() + elif cmd == "matrix": + enter_matrix_mode() + else: + print(f"โš ๏ธ Unknown option: {cmd}") + print("Usage: terminal-talks [theme | matrix]") + else: + run_main() diff --git a/submissions/Terminal_Talks/themes/dark.sh b/submissions/Terminal_Talks/themes/dark.sh new file mode 100755 index 00000000..949e5198 --- /dev/null +++ b/submissions/Terminal_Talks/themes/dark.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Dark terminal prompt +echo "Applying Dark Theme..." +sed -i '/# TerminalTalks Theme/d' ~/.bashrc +echo '# TerminalTalks Theme' >> ~/.bashrc +echo 'export PS1="\[\033[0;32m\]\u@\h:\w$ \[\033[0m\]"' >> ~/.bashrc +source ~/.bashrc diff --git a/submissions/Terminal_Talks/themes/hacker.sh b/submissions/Terminal_Talks/themes/hacker.sh new file mode 100755 index 00000000..b22dd33a --- /dev/null +++ b/submissions/Terminal_Talks/themes/hacker.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Hacker green prompt +echo "Applying Hacker Theme..." +sed -i '/# TerminalTalks Theme/d' ~/.bashrc +echo '# TerminalTalks Theme' >> ~/.bashrc +echo 'export PS1="\[\033[1;32m\][HACKER] \u@\h:\w$ \[\033[0m\]"' >> ~/.bashrc +source ~/.bashrc diff --git a/submissions/Terminal_Talks/themes/light.sh b/submissions/Terminal_Talks/themes/light.sh new file mode 100755 index 00000000..5046007d --- /dev/null +++ b/submissions/Terminal_Talks/themes/light.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# Light terminal prompt +echo "Applying Light Theme..." +sed -i '/# TerminalTalks Theme/d' ~/.bashrc +echo '# TerminalTalks Theme' >> ~/.bashrc +echo 'export PS1="\[\033[1;34m\]\u@\h:\w$ \[\033[0m\]"' >> ~/.bashrc +source ~/.bashrc