Binding caps-lock to a range of commands

I never use caps lock, so I’d like to use it as an addition custom modifier key. What modifier keys are there? Super, meta, hyper?

Could I turn the caps lock key into say “hyper” and then assign commands to hyper-a, hyper-b etc? How would I do that?

I’m thinking mainly of commands like beginning of line, end of line etc. Where would those commands (that are currently found to other legal so I can assign them?

Hat’s the use of event sourcing and asynchronous message queue for sending commands

In short: Out of order commands end up with out of order events, so does the ordering of the events matter in such situations?

Since we are uncertain about the order of commands when an asynchronous message queue like Rabbitmq is used for sending the commands,so we are uncertain about the order of the resulting events.

So what is the use of persisting the events as a sequence when we are unsure about their order?

What are design tips for using rabbitmq for sending commands and event store?

Can I use an irc chat room to relay my game commands?

I am programming a (kind of) multiplayer text game.

There are turn by turn combats. I actually use an external irc chat room to send and receive commands for these combats.

My question is: Does an irc chatroom discard some text if there are too many at a time ? Is there a technical limit concerning number of people in a chat room ?

Any suggestion are welcome.

What are the best documentation sources for SQL query commands and syntax?

I have been looking and looking for a good source for SQL query language documentation online. I haven’t been able to find any good source.

Cross-cutting this question is the fact that I think there are different flavors of SQL.

So perhaps the question should be re-phrased: What are the best sources for the various flavors of SQL? (e.g. MySQL, PostgresSQL, etc…)

And also: Given that there are many flavors of SQL, is there a core SQL syntax that is common to all?

One source that I’ve found that I don’t find particularly good is the from w3schools.

Bash, if more commands true then ok

is possible to do samothing like this?

if rsync $  folder/coopshop/prod $  folder2/coopshop rsync $  folder/coopweb/prod $  folder2/coopweb rsync $  folder/unihobbyshop/shop $  folder2/unihobbyshop rsync $  folder/unnihobbyweb/web $  folder2/unihobbyweb then   echo "OK! rsync done!" else   echo "Error! rsync crashed!" fi 

I know there is possibility to do with \ character at the end of line, but this is not quite elegant solution. Is better way to do this?

Thank you.

Automatically checking argument types in commands of a Telegram bot

I am writing a simple Telegram bot in Python 3 using the python-telegram-bot library. I was not very happy with the ‘command handling’ provided by the library because this code is not beautiful at all and is very noisy:

def caps(update, context):     text_caps = ' '.join(context.args).upper(), text=text_caps)  caps_handler = CommandHandler('caps', caps) dispatcher.add_handler(caps_handler) 

So I wanted to create a more convenient way, and now a command looks like this:

@cmd('hello') def cmd_hello(msg, a:int, b:[float], c:str):     s = ''     s += 'Number: '+str(a)+'\n'     s += 'Floats: '+str(b)+'\n'     s += 'String: '+c     return s 

If i send this command: /hello 1 3.14 5 3.7 world to the bot, the response will be:

Number: 1 Floats: [3.14, 5.0, 3.7] String: world 

I am using the inspect module to read the argument annotations of a function and store them in a dict:

Cmd = namedtuple('Cmd',['func','patterns']) commands = dict()  def cmd(name):     def deco(func):         args = []         sig = signature(func)          for arg_name, param in sig.parameters.items():             ann = param.annotation             if ann:                 args.append(ann)             else:                 args.append(str)          args.pop(0)         commands[name] = Cmd(func, tuple(args))         return func     return deco 

The process_args function takes: 1) a list of raw (str) arguments that a bot receives in a message, 2) a list of patterns to match the arguments; and returns a list of processed (converted) arguments or raises CmdError if the arguments are incorrect.

def process_args(args, patterns):     patterns = list(patterns)      processed = []     while patterns:         if not args:             raise CmdError("Not enough arguments")          pattern = patterns.pop(0)          if pattern in (int, float, str):             arg = args[0]             try:                 converted = pattern(arg)             except Exception:                 raise CmdError(f"Cannot parse argument {arg} as {pattern.__name__}")             args.pop(0)             processed.append(converted)          elif isinstance(pattern, list):             pat_single = pattern[0]             collected = []              match = True             while match:                 try:                     x = process_args([args[0]], [pat_single])[0]                 except CmdError: # If the pattern isn't matched anymore                     match = False                 else:                     collected.append(x)                     args.pop(0)             processed.append(collected)      return processed 

This function looks really bad. Is there a better way of implementing a pattern matching like this?

bash exit with most of the native commands

Whenever I run a command like “autocomplete (tab)”, grep, which, etc, bash window is closed without any warning.

Before this happens, I was playing with the trap command to create a script to handle process failures in a screen session, but I did not really change anything. I am not sure if that has anything to do with this.

Any suggestion on how to track what is happening?

How to script file for a Mac with several Terminal commands

I have few Terminal commands which i’m using so frequently,So i though to automate it to reduce the effort of copy-pasting the commands one by one in terminal and time.

I created a .command file for this but the issue with it is, it is only executing the first statement.

The first statement is connecting to a remote server and it needs a password , for that i usually copy-paste the password. When i changed it to a .command file after executing the first command it is requesting a password in a new window and further commands are not getting executed in the new window.

Does can anyone help/suggest to find a way to do this?

Below is the commands,

#!/usr/bin/expect set timeout 60 set host set name root  set password **************  spawn ssh $  host -l $  name   expect {     "(yes/no)?" {         send "yes\n"         expect "password:"         send "$  password\n"     }     "password:" {         send "$  password\n"     } }  expect "#" # test whether login to host send "ssh-agent bash\n" send "ssh-add etlbi-master\n" send_user "Now you can do some operation on this terminal\n" send “ssh-add etlbi-master” 

Getting the below error,Also not able to enter any commands on the terminal window.

Last login: Thu Jun 20 17:39:57 2019 from root@Ubuntu-1689-xenial-64-minimal ~ # Now you can do some operation on this terminal usage: send [args] string     while executing "send “ssh-add etlbi-master”"     (file "/Users/sand/Documents/google/newtest.command" line 25) logout Saving session... ...copying shared history... ...saving history...truncating history files... ...completed.   [Process completed] 

Note: i’m the admin.

Thanks in advance!