terminal

Use input() and print() at the same time (like in a chat)

时间秒杀一切 提交于 2019-12-11 07:43:51
问题 I am learning Python, and I have decided to make some practise by coding a mini chat in terminal, with a server and a client. But there is a problem, to make a real chat, the client must be able to type, send and receive messages in the same time like that: //MESSAGES >bla bla to send So messages are scrolling while in the bottom of the shell, there's my input. I have searched the web how to make that, maybe the multi-threading, no. The input() fonction blocks the process. If you have an

Create two separate windows in terminal

喜夏-厌秋 提交于 2019-12-11 07:09:55
问题 Picture a terminal. There are two windows inside that terminal. One on top, one on bottom. The top one is much bigger. The top one receives asynchronous updates. The bottom one is for user input. It would work almost exactly the same as vim - the text editor. I'm writing this in Python. I'm guessing you would do this by using curses , but I'm not sure if it's possible. 回答1: Yes, you want the python standard library implementation of ncurses for this. 回答2: http://docs.python.org/library/curses

What regex to find files with CJK characters using `find` command?

北城以北 提交于 2019-12-11 06:45:01
问题 The files I'm looking for are of the form cmn-我.flac , where the CJK character is variable. Using find command, what regexp should I use to find all files with a single CJK characters in its name? Hints: The following regexp find all files including those with and without CJK characters : find ./ -regex '.*\..*' # ex: cmn-我.flac Then : find ./ -regex "cmn-.*[\x4e00-\x9fa5]*\.flac" # the `-` breaks => fails find ./ -regex ".*[\x4e00-\x9fa5]*\.flac" # finds with n CJK characters => we get

Can't Disable “Antialias text” Option Using Menlo Font in Terminal.app [closed]

大兔子大兔子 提交于 2019-12-11 06:22:59
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . Quite simply, when I'm using the Menlo font in OS X's Terminal.app, the ability to uncheck "Antialias text" is not allowed. The checkbox is disabled, and this only occurs when I'm using the Menlo Regular font face (chosen by default in the Pro theme). See the following screenshot: Terminal.app Preferences http:/

Edit yaml objects in array with yq. Speed up Terminalizer's terminal cast (record)

此生再无相见时 提交于 2019-12-11 06:17:04
问题 The goal: Speed up Terminalizer's terminal cast (record) I have a record of terminal created with Terminalizer. cast.yaml : # The configurations that used for the recording, feel free to edit them config: # do not touch it # Records, feel free to edit them records: - delay: 841 content: "\e]1337;RemoteHost=kyb@kyb-nuc\a\e]1337;CurrentDir=/home/kyb/devel/git-rev-label\a\e]1337;ShellIntegrationVersion=7;shell=fish\a" - delay: 19 content: "\e]1337;RemoteHost=kyb@kyb-nuc\a\e]1337;CurrentDir=/home

Quit a running command based on output in bash

走远了吗. 提交于 2019-12-11 06:10:33
问题 I have a process which I start running using $ somecommand build It basically installs an app on an Android emulator and then starts up the emulator. This process keeps running forever until i manually kill it. This command outputs a bunch of debug info into the terminal, also while running the app. I'd like to kill the command when somewhere in this continuous output, the string [TESTS_ENDED] has been outputted on the terminal. Any oneliner on how to do this? 回答1: Using awk , with help from

How can jupyter access a new tensorflow module installed in the right path?

偶尔善良 提交于 2019-12-11 06:05:15
问题 Where should I stick the model folder? I'm confused because python imports modules from somewhere in anaconda (e.g. import numpy), but I can also import data (e.g. file.csv) from the folder in which my jupyter notebook is saved in. The TF-Slim image models library is not part of the core TF library. So I checked out the tensorflow/models repository as: cd $HOME/workspace git clone https://github.com/tensorflow/models/ I'm not sure what $HOME/workspace is. I'm running a ipython/jupyter

Trick to use file paths with spaces in Mallet (Terminal, OSx)?

人走茶凉 提交于 2019-12-11 05:47:24
问题 Is there a trick to be able to use file paths with spaces in Mallet through the terminal on mac? For example, all of the following give me errors: escaping the space ./bin/mallet import-dir --input /Volumes/Macintosh\ HD/Users/MY_NAME/Desktop/en --output /Users/MY_NAME/Desktop/en.mallet --remove-stopwords TRUE --keep-sequence TRUE double quotes, no escapes ./bin/mallet import-dir --input "/Volumes/Macintosh HD/Users/MY_NAME/Desktop/en" --output /Users/MY_NAME/Desktop/en.mallet --remove

Can you remove the alpha channel in a PNG with SIPS?

吃可爱长大的小学妹 提交于 2019-12-11 05:36:35
问题 Trying to stay native in SIPS when removing the alpha channel from images I am familiar with the process in ImageMagick with: convert -flatten test.png test-white.png or: convert test.png -background white -alpha remove test.png but when I reference the man page on ss4 and Library it tells me that hasAlpa is a boolean read only when I run: sips -g hasAlpha test.png Per searching under the tag sips and with: sips transparency sips remove there wasn't anything mentioned for removing

Fish shell and rvm - allowing login shell

两盒软妹~` 提交于 2019-12-11 05:29:00
问题 When I try to use rvm in fish shell, I get this message: ciembor@ciembor ~> rvm use 1.9.2 RVM is not a function, selecting rubies with 'rvm use ...' will not work. You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use /bin/bash --login as the command. Please visit https://rvm.io/integration/gnome-terminal/ for a example. I get used to use /bin/bash --login , then rvm and then starting fish from bash . But isn't there more straightforward