terminal

Python - Clearing the terminal screen more elegantly

谁说胖子不能爱 提交于 2020-01-09 10:59:02
问题 I know you can clear the shell by executing clear using os.system , but this way seems quite messy to me since the commands are logged in the history and are litterally interpreted as commands run as the user to the OS. I'd like to know if there is a better way to clear the output in a commandline script? 回答1: print "\033c" works on my system. You could also cache the clear-screen escape sequence produced by clear command: import subprocess clear_screen_seq = subprocess.check_output('clear')

Errors Merging a Git Submodule into its Parent Repository in OS X

断了今生、忘了曾经 提交于 2020-01-07 08:28:10
问题 I have cloned a parent repository ' objc4 ' from https://github.com/RandomDSdevel/objc4 to the local path ' /Volumes/Development/Repositories/objc4 .' This parent repository contains a submodule ' OBJC4-437.1-Runtime ' which I have set up to mirror the contents of https://github.com/macmade/OBJC4-437.1-Runtime at the local path ' /Volumes/Development/Repositories/objc4/runtime .' I would like to merge this submodule into its parent repository and have already attempted to do so using these

Python imports with __init__.py

元气小坏坏 提交于 2020-01-07 03:59:20
问题 No matter how I structure the imports in the code files and in the __init__.py files, I can't seem to get it right for executing the program and running the tests using pytest . How do I need to write the imports when my project structure looks like this: src/ __init__.py VocableFileWriter.py WordListHelper.py WordListReader.py XLDAttributeValueAdder.py exceptions/ __init__.py XMLInvalidException.py XMLParseException.py gui/ __init__.py GTKSignal.py XLDAttributeValueAdderWindow.py test/ _

How do I run a set of Terminal commands from a spreadsheet?

China☆狼群 提交于 2020-01-07 03:12:29
问题 I have to run a set of Entrez Direct commands to run in Terminal based on queries/search phrases in a column in a spreadsheet. How can I automatically run a terminal command repeatedly based off of a spreadsheet? i.e., I have this command: esearch -db pubmed -query "<query>" | efetch -format docsum | xtract -pattern DocumentSummary -element PubDate | cut -c 1-4 | sort-uniq-count > <directory>/<name>.xls And a spreadsheet that contains values for <query> in a column, and I can also put in

password masking in c++

半世苍凉 提交于 2020-01-07 03:04:53
问题 I want to implement a login form in c++, so I wrote a function as follows: string setPass(bool show_asterisk = true) { const char BACKSPACE = 8;//ASCII code for BACKSPACE Key const char ENTER = 13;//ASCII code for ENTER Key string pass = " ";//initialize string char c = ' ';//initialize character while ((c = _getch()) != ENTER) { if (c == BACKSPACE) { if (pass.length() != 0) { if (show_asterisk) cout << "\b \b"; pass.resize(pass.length() - 1); //resize the length of pass } } else if (c == 0 |

How to remove line numbers in vim?

对着背影说爱祢 提交于 2020-01-07 01:52:27
问题 I have set line numbers in vim using :%!cat -n as suggested here. The line numbers appeard but now when I open vim I am getting 'E481: No range allowed:' errors and now I want to get rid of the line numbers. But how? 回答1: First, you can try this to get the line numbers: :%!cat -n % If you've not saved, you can revert back to the last save: :e! If you have the line numbers, then you can get rid of them like this :%s/^[[:blank:]]*[0-9]*\t// 来源: https://stackoverflow.com/questions/36579720/how

How to remove line numbers in vim?

坚强是说给别人听的谎言 提交于 2020-01-07 01:50:06
问题 I have set line numbers in vim using :%!cat -n as suggested here. The line numbers appeard but now when I open vim I am getting 'E481: No range allowed:' errors and now I want to get rid of the line numbers. But how? 回答1: First, you can try this to get the line numbers: :%!cat -n % If you've not saved, you can revert back to the last save: :e! If you have the line numbers, then you can get rid of them like this :%s/^[[:blank:]]*[0-9]*\t// 来源: https://stackoverflow.com/questions/36579720/how

How can I uninstall google-cloud-sdk ?

爱⌒轻易说出口 提交于 2020-01-06 19:51:09
问题 I tried deleted Google Cloud AppEngine SDK from macbook, but I'm getting this Last login: Thu Aug 11 14:12:18 on ttys002 -bash: /Users/Squirrel/Desktop/google-cloud-sdk/path.bash.inc: No such file or directory -bash: /Users/Squirrel/Desktop/google-cloud-sdk/completion.bash.inc: No such file or directory Whenever I open a new terminal window. Is there a way I can stop that from happening? 回答1: Converting the comment to an anwer... Some SDK installations may modify system or user profiles to

Ncurses limited output size

心不动则不痛 提交于 2020-01-06 17:59:32
问题 I'm learning how to use ncurses and I'm in a weird situation. It seems my output can't go over 24 lines. Moreover, whenever I run my software, and the execution finishes his job, my terminal stops working as before, and I have 2 different situations: if I've launched my run from a line behind line 24 I can use the terminal, but if I keep scrolling when at the last line of the window, nothing more happens: all input and output keep happening in the last line, without any new line appearing at

Discovering remote Terminal for Terminal Escape Codes? (DECDHL in this case)

送分小仙女□ 提交于 2020-01-06 16:22:28
问题 I am trying to determine WHAT console I am running in. (Exceptionally hard based on the research I have done so far.) The latest feature that I discovered that would be useful is Double High, Double Wide for a couple of scenarios. The setup is a Kubuntu 15.04 machine with native (lower) and remote access via Terminal.app on OS X 10.10.4. Based on vt100.net Apple is doing the right thing. #!/bin/bash # Cool effect with OS X Terminal.app # Not as much on others (Like Konsole) function embiggen(