LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > LinuxQuestions.org > LQ Suggestions & Feedback
User Name
Password
LQ Suggestions & Feedback Do you have a suggestion for this site or an idea that will make the site better? This forum is for you.
PLEASE READ THIS FORUM - Information and status updates will also be posted here.

Notices


Reply
  Search this Thread
Old 04-19-2023, 12:23 AM   #1
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,585
Blog Entries: 19

Rep: Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454Reputation: 4454
A facility for storing useful scripts for general use?


Today I found two useful scripts on the first page of "Latest posts". One invoked Google Translate to translate strings from the command line (the actual script was in a linked blog), and the other was a wrapper for a fingerprint reader to turn it into a screen-unlocker. Sadly, these will gradually disappear from sight as more threads are added.

It would be nice to have a little repository where such gems can be stored.

Last edited by hazel; 04-19-2023 at 12:36 AM.
 
Old 04-19-2023, 11:13 AM   #2
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,226

Rep: Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320Reputation: 5320
I'd make a page on the horribly-underused LQ Wiki and link to them there.
 
1 members found this post helpful.
Old 04-24-2023, 05:14 PM   #3
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,138
Blog Entries: 6

Rep: Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827
@hazel
Most basic little translator in bash. Needs curl. You could also use wget.

trans.sh
Code:
#!/usr/bin/bash

agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:110.0) Gecko/20100101 Firefox/110.0"

echo -e "\nGoogle Translator\n"
echo -e "For language abbreviations look at: "
echo -e "https://developers.google.com/admin-sdk/directory/v1/languages\n"

read -p "Enter input language: " inLang
read -p "Enter output language: " outLang

read -p "Enter phrase to translate from "$inLang" to "$outLang" :" phrase

phrase=${phrase// /+}

url="http://translate.googleapis.com/translate_a/single?client=gtx&sl=${inLang}&tl=${outLang}&dt=t&q=${phrase}"

echo -e "\nThis is the google api url: "$url"\n"

curl -A "$agent" "$url"
Example usage:
Code:
bash ./trans.sh

Google Translator

For language abbreviations look at: 
https://developers.google.com/admin-sdk/directory/v1/languages

Enter input language: de
Enter output language: en
Enter phrase to translate from de to en :Ich habe Probleme mit dem Programm awk, um den zweiten Treffer eines Strings auszugeben

This is the google api url: http://translate.googleapis.com/translate_a/single?client=gtx&sl=de&tl=en&dt=t&q=Ich+habe+Probleme+mit+dem+Programm+awk,+um+den+zweiten+Treffer+eines+Strings+auszugeben

[[["I'm having trouble using the awk program to print the second match of a string","Ich habe Probleme mit dem Programm awk, um den zweiten Treffer eines Strings auszugeben",null,null,3,null,null,[[]],[[["1fdac2347d4ad2bfc63cca9b4fbecbbb","de_en_2022q1.md"]]
 
Old 04-24-2023, 06:14 PM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by hazel View Post
It would be nice to have a little repository where such gems can be stored.
Also known as a git repository.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Helpful scripts] Useful add-on scripts for B/LFS ReaperX7 Linux From Scratch 1 01-25-2016 05:25 PM
[SOLVED] Directory for storing CGI scripts zak100 Linux - Newbie 2 10-02-2013 05:20 AM
[SOLVED] shell scripts: storing result of a command into a variable newbiecolonopenparens Linux - Newbie 14 05-24-2012 06:08 PM
Storing password used in shell scripts in encrypted file Swakoo Linux - Security 2 12-06-2006 10:39 PM
How to use clipboard facility ? m.parthiban Red Hat 1 09-19-2005 04:40 AM

LinuxQuestions.org > Forums > LinuxQuestions.org > LQ Suggestions & Feedback

All times are GMT -5. The time now is 06:35 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration