## voice dictation – How can I test vocal commands?

I’ve defined vocal commands using `System Preferences ﹥ Accessibility ﹥ Dictation` (macOS 10.14.4). Sometimes they work, sometimes they don’t. I guess recognition rate is not 100%, and I’d like to improve it, for instance by chosing different wording. “Make it so” may be better recognized than “Engage”. How can I get feedback on recognition rate?

## samsung – Smasung Galaxy A51 stuck in bootloop, recognized by adb, not responding to adb commands

I have a Samsung Galaxy A51 that is stuck in a Boot-loop. Phone was originally water damaged, but worked until my Dad tried to charge it. I replaced the inside part of the phone with the USB port. When I run ADB (I have drivers) my phone shows up under ADB devices. But it does not respond to ANY ADB commands, I can’t root, or push files. I also tried ODIN but I get “Odin Protocol version ERROR”.
MAIN PROBLEM: phone shows up under ADB devices but does not respond to any ADB commands.
Any advice would be appreciated, thank you.

## Bazel/Gazelle chaining commands – Stack Overflow

I wanted to simplify the dependency update process for our bazel monorepo, we want to run these commands in order defined in the root `BUILD.bazel` (go directory contains all our go code):

``````bazel run //:gazelle
bazel run //:gazelle -- update-repos -from_file=go.mod`
bazel run //:gazelle
``````

These commands will basically update any new dependencies across workspace then rebuild go code. I am guessing this can be achieved with a rule, but I couldn’t figure out how to get it to work.

## Docker container with a dockerfile and commands to build, run and manage your Docker images

Say you went to the fish market to buy fish. There were two sizes of fish available. The fisherman told that the total price of the smaller fish is 3 times the total price of the bigger fish. Also, the total money that you bought from your home is Rs.100. Can you find out how much did you spend to buy the two types of fish? Run your Python application to solve the problem in a Docker container with a Dockerfile and commands to build, run, and manage your Docker images. Hint: use numpy library to solve system of linear equation.

## Is there an order to placing commands in .htaccess file?

I have to keep the below block at the bottom of my htaccess file or other commands won't work. Why? I didn't think there was any order to commands in the Apache file. Is that right?
# BEGIN WordPress
#NEEDS TO BE AT END OF FILE OR HIDE DEBUG FILE CODE DOESN'T WORK
RewriteEngine On
RewriteBase /
RewriteRule ^index.php\$ – (L)

RewriteRule ^files/(.+) wp-includes/ms-files.php?file=\$1 (L)

RewriteCond %{REQUEST_FILENAME} -f (OR)
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^…

Is there an order to placing commands in .htaccess file?

## Is there an app for mapping media events to adb shell commands

I’d like to know if there is an that runs commands in the Android shell, just like giving commands to ADB with `adb shell input text 'Hello'`.

What I want to achieve is making my phone run a command (`input tap 300 700`) when I press the play/pause button on my Bluetooth earbud.

## Background

I am writing a custom library whose keywords can be used with Robot Framework to verify configuration files, check running processes, and eventually other things tailored to a project I work on. The Robot tests would eventually be included as part of a Jenkins job.

I’m not used to writing Python or using OOP and I would love any feedback at all. Here are some specific things I’m worried about:

• The organization and correctness of my functions and classes.
• Is anything obviously missing or bad or confusing?
• Am I properly cleaning up any created paramiko sshh connections?
• Am I doing things in a “pythonic” way?

### Directory layout

Note, I did not include the unit tests.

``````.
├── Intrepid.py
├── SSHClient.py
└── tests
├── main.py
├── test_Intrepid.py
└── test_SSHClient.py
``````

### An example main.py

Here is an example of using the `create_new_session()` function in the Python code.

``````import os, sys

sys.path.append(os.path.dirname(os.path.dirname(
os.path.abspath(__file__))))
from Intrepid import Intrepid

server ='localhost'
# Set to a valid local user on your machine.
running_process ='sys-kernel-debug.mount'

intrepid.is_process_running(running_process)
intrepid.close_session()
``````

### Robot Framework example

Using the above python function in Robot would look like:

``````    Create new session   \${HOST}     \${USER}      \${PASSWORD}
Check service on host  \${HOST}     \${service}
Close session
``````

## The Code

### The Intrepid Class

This class is where custom keywords could be defined which could be called from the Robot Framework.

``````import subprocess
import logging
import xml.etree.ElementTree as ET
from SSHClient import SSHClient

LOGGING_LEVEL = logging.INFO

class Intrepid:

logging.basicConfig(format='%(asctime)s %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p',
level=LOGGING_LEVEL)
self.log = logging.getLogger(__name__)

self.ssh_client = None
self.working_directory = '/tmp'

"""
Robot users call this function to begin an SSH session.
"""
self.log.info('Creating new ssh session')

def is_process_running(self, process_name):
"""
Check if a process is running on a remote system.

Use from Robot like so:
Is process running  | ing-flowgen
"""
cmd = 'systemctl status' + ' ' + str(process_name)

if self.ssh_client.run_remote_command(cmd) == 0:
self.log.info('Found process %s', process_name)
return True

# The Robot framework uses exceptions to
# figure out whether a keyword test passed.
error_string = "Process " + process_name + " is not running."
self.log.info(error_string)

raise ServiceNotRunning(error_string)

def xml_file_contains(self, xml_file, expected_text, xpath):
"""
Search for text in an XML file. Raise an exception
if it doesn't exist.

Use from Robot like so:
XML file contains | Full path to XML file | Expected text | XPath to xml element
"""

tree = ET.parse(xml_file)
root = tree.getroot()
value = root.find(xpath)
if value is None:
message = "Could not find: " + xpath
self.log.info(message)
raise XMLElementNotFound(message)
elif value.text != str(expected_text):
message = "Expected value " + expected_text + " does not match actual value " + value.text
self.log.info(message)
raise XMLElementDoesNotMatch(message)

print("Values match")
return True

def close_session(self):
"""
Robot users must choose when to close the connection.
"""
self.ssh_client.close()
self.log.info('Closing ssh session')

class ServiceNotRunning(Exception):
pass
"""
If Robot catches an exception it reports
that the test has failed.
"""
class XMLElementNotFound(Exception):
pass
class XMLElementDoesNotMatch(Exception):
pass
``````

### The SSHClient Class

``````import paramiko
from paramiko.ssh_exception import BadHostKeyException, AuthenticationException, SSHException
import socket
from time import sleep
from sys import exit
import os
import logging

LOGGING_LEVEL = logging.WARNING

class SSHClient:
print_stdout=None, retries=None,
interval=None, timeout=None):

logging.basicConfig(format='%(asctime)s %(message)s',
datefmt='%m/%d/%Y %I:%M:%S %p',
level=LOGGING_LEVEL)
self.log = logging.getLogger(__name__)

self.server = server
self.print_stdout = print_stdout if print_stdout is not None else True
self.retries = retries if retries is not None else 3

# interval and timeout are in seconds.
self.interval = interval if interval is not None else 2
self.timeout = timeout if timeout is not None else 5

try:
except:
raise ConnectionError('Could not establish an SSH connection. Exiting')

def __enter__(self):
return self

ssh_client = paramiko.SSHClient()

# No need to enforce host key checking. Testing is done on
# a private network.

for attempt in range(self.retries):
try:
self.log.info('Successfully started ssh_client')
return ssh_client

SSHException, socket.error) as e:
error_message = "Failed to connect on attempt " + str(attempt) + " " + str(e)
self.log.warning(error_message)
sleep(self.interval)

# Could not successfully create an ssh session
ssh_client.close()
raise Exception('Failed to establish ssh connection')

filename = os.path.basename(remote_file)
local_file = os.path.join(local_path, filename)

sftp = self.ssh_client.open_sftp()
filename, self.server, local_file)
try:
sftp.get(remote_file, local_file)
self.log.info('Successfully saved file %s', local_file)
return local_file
except Exception as e:
finally:
if sftp: sftp.close()

def close(self):
self.server = None
self.print_stdout = None
self.retries = None
self.interval = None
self.timeout = None

self.ssh_client.close()
self.log.info('Closing ssh connection.')

def run_remote_command(self, cmd_to_execute):
'''Run a command on a remote machine.

We do not explicitly close the ssh connection here incase we want to chain
multiple commands over one ssh connection. Leave the decision to close
the connection to the user.
'''
self.log.info('Attempting to run command %s on server %s',
cmd_to_execute, self.server)
try:
stdin, stdout, stderr = self.ssh_client.exec_command(cmd_to_execute)
self.log.info('Command succeeded')
except (BadHostKeyException, AuthenticationException, SSHException, socket.error) as e:
self._print_output(stderr)
self.warning("Failed to run ssh command with error: ", e)
self.close()
error_message = "Failed to run ssh command " + e
raise Exception(error_message)

if self.print_stdout == True:
self._print_output(stdout)

remote_return_code = stdout.channel.recv_exit_status()

if remote_return_code != 0:
print("Remote command failed with return code: ", remote_return_code)

return remote_return_code

def _print_output(self, command_output):
print(line, end="")

def __exit__(self, exc_type, exc_value, traceback):
self.close()
$$```$$
``````

## General commands for getting help and/or documentation for command line utilities in terminal on macOS?

Some command line interfaces or command line utilities give some comprehensive documentation or help when `--help` is appended to the name of the command, for example `git`:

``````git --help
# shows comprehensive help docs
``````

Some others show only the command and its arguments (that’s all), for example `grep`:

``````grep --help
usage: grep (-abcDEFGHhIiJLlmnOoqRSsUVvwxZ) (-A num) (-B num) (-C(num))
(-e pattern) (-f file) (--binary-files=value) (--color=when)
(--context(=num)) (--directories=action) (--label) (--line-buffered)
(--null) (pattern) (file ...)
``````

And others give some assistance, but only because `--help` is not recognised as a legal option, for examples `ls`:

``````ls --help
ls: illegal option -- -
usage: ls (-@ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1%) (file ...)
``````

and `netstat`:

``````netstat --help
netstat: illegal option -- -
Usage:  netstat (-AaLlnW) (-f address_family | -p protocol)
netstat -i | -I interface (-w wait) (-abdgRtS)
netstat -s (-s) (-f address_family | -p protocol) (-w wait)
netstat -i | -I interface -s (-f address_family | -p protocol)
netstat -m (-m)
netstat -rs (-s)
``````

### Question

Are there any generally safe way(s) of getting documentation or help with a CLI or utility without having to google (i.e. from within the terminal)? I currently try `--help` or `-h`, but other than that I go straight to google, but would like to know if there are other things to (safely) try before going to google.

## bash – rbenv not allowing me to use ruby commands

I tried installing rbenv in my ubuntu 18.04 server and it worked (shows list of versions, locally or globally) but `ruby -v`returns

``````mr2552@ip-10-5-121-225:~\$ ruby -v

snap install ruby  # version 3.0.1, or
apt  install ruby

See 'snap info ruby' for additional versions.
``````

As rbenv failed, I tried to install ruby with snap
`sudo snap install ruby --classic --channel=latest/stable`
and then removed it because I was going to need rbenv later on.
`sudo snap remove ruby --classic --channel=latest/stable`

now `ruby -v` returns
`bash: /snap/bin/ruby: No such file or directory`

How do I revert from `bash: /snap/bin/ruby: No such file or directory` to

``````mr2552@ip-10-5-121-225:~\$ ruby -v

snap install ruby  # version 3.0.1, or
apt  install ruby

See 'snap info ruby' for additional versions.
``````

I want to solve the main issue (ruby -v not showing rbenv version) but I think this new problem might interfere in the future?

## sharepoint online – Using date commands in calculated fields

https://support.microsoft.com/en-us/office/examples-of-common-formulas-in-lists-d81f5f21-2b4e-45ce-b170-bf7ebf6988b3

A simple sample is this:
=DATEDIF((Dato1),(Dato2),”d”)

However when i save the column I get following error:

Sorry, something went wrong The formula contains a syntax error or is
not supported.

If I just do this it works:
=(Dato1)-(Dato2)

However I need to calculate hours and days between two dates so I need some of the commands. Any pointer what I am doing wrong?