terminal

Implement overlay in terminal

橙三吉。 提交于 2019-12-13 07:57:34
问题 I want to create an overlay in terminal This Q&D shows the time in right/bottom #include <stdio.h> #include <stdlib.h> #include <termcap.h> #include <termios.h> #include <error.h> #include <unistd.h> #include <time.h> static char termbuf[2048]; int main() { char *termtype = getenv("TERM"); time_t timer; char buffer[26]; struct tm* tm_info; if (tgetent(termbuf, termtype) < 0) { error(EXIT_FAILURE, 0, "Could not access the termcap data base.\n"); return 1; } int lines = tgetnum("li"); int

editing tomcat-users.xml in CentOS 7 linux

烂漫一生 提交于 2019-12-13 07:50:23
问题 I am trying to edit tomcat-users.xml in tomcat 8 , using the terminal of CentOS 7 linux . I typed su - to use the terminal as the root account. I then typed in vi $CATALINA_HOME/conf/tomcat-users.xml , but the result is that vi opens in the window with the contents of tomcat-users.xml in read-only mode, and there seems to be no way out of vi except to close the window, losing all the terminal history. I also navigated to the physical location of tomcat-users.xml and opened up the file using

How to install selenium python on Mac

强颜欢笑 提交于 2019-12-13 07:25:44
问题 I've downloaded the Selenium zip file for python and it contains the folder with the setup.py. It says on python.org that I have to type in terminal 'python setup.py install' but it gives me this error that I need to be administrator because I have no permission to the directory, when in fact my user is already an administrator: Checking .pth file support in /Library/Python/2.7/site-packages/ error: can't create or remove files in install directory The following error occurred while trying to

Not able to Restart Apache2 in local azure instance

泪湿孤枕 提交于 2019-12-13 07:24:59
问题 Yesterday i saw my mysql,apache inside azure instance (in terminal) is not running. so i tried following commands sudo service mysql start then mysql started after i tried apache sudo service apache2 start ,i tried sudo service apache2 stop and sudo service apache2 start , also i tried sudo service apache2 restart it showing following message apache2: Could not reliably determine the server's fully qualified domain name, using 10.102.170.55 for ServerName apache2: Could not reliably determine

Vim insert strange characters when trying to fix Alt key

早过忘川 提交于 2019-12-13 07:19:09
问题 I found the workaround for mapping Alt key on gnome-terminal in this topic. After editing the vimrc file, my Vim now recognizes Alt - j as ê (which is a non-english character), how can I fix it? Thanks 回答1: As explained in the referenced topic, for Vim, Alt + character combinations are represented by ASCII characters with the 8th bit set, which is identical to certain special characters (such as ê ). As long as you don't need to type those characters (e.g. because you write in French :-), you

Python output to terminal during ssh login

偶尔善良 提交于 2019-12-13 07:16:14
问题 I have been looking everywhere for this and have not found a solution. I am using python 2.5.1 on an Apple iPod and I am trying to connect to a host with SSH. First I start off with import os . Next I os.system('ssh 192.168.1.13) . After this command is executed I next try to os.system('password') . This does not work and SSH asks for the password, after I exit the SSH session then my password is printed. Is there any way that I can get it so that it sends the password to SSH? I don't want to

How to run PHP script at a certain time using at command?

泪湿孤枕 提交于 2019-12-13 06:34:18
问题 I need to run a PHP script once at a specific time. I'm doing it by: shell_exec('echo /usr/local/bin/php /home/xxx/public_html/yyy.php param1 | /usr/bin/at now + 1 minutes'); yyy.php takes param1 from $_SERVER['argv'][1] and does its thing based on the value. I've tested yyy.php and the script works as it should. The problem I'm running into is I can't seem to get the at command to properly execute the PHP script. I've tried different variants, such as: shell_exec('/usr/local/bin/php /home

Who to get/copy a specific word from a text file using bash?

徘徊边缘 提交于 2019-12-13 06:26:26
问题 when I do this: LINE=$(head -38 fine.txt | tail -1 | cut -f2) I get the 38th line of the file, which is: Xres = 1098 but I only need to record 1098 as value for a variable. I am training to read a text file and record values and use them as parameters later in my script. 回答1: Add | awk '{print $3}' to the pipeline. 回答2: sed -n '38s/.*= *//p' fine.txt By default, sed prints every input line. The -n option disables this behavior. 38 selects line number 38 and when this line is seen, the

String storage in Python Class includes newline character

和自甴很熟 提交于 2019-12-13 06:21:47
问题 I have an output class that looks like the following (somewhat redacted): from colorclass import Color from colorclass import disable_all_colors, enable_all_colors, is_enabled from time import localtime, strftime from ApplicationFiles.lib.core.__version__ import __version__ from enum import IntEnum class OutputHelper(object): def __init__(self, arguments, app): if arguments.nocolor: disable_all_colors() self.domain = "undefined" self.severity_print = arguments.severity self.verbose =

Sending Control-N and <CR><LF> via telnet using C#

有些话、适合烂在心里 提交于 2019-12-13 05:35:52
问题 I am currently using minimalistic Telnet from CodeProject and am having trouble sending the correct output to my telnet device. Essentially I am trying to automate the gathering of config data from Netopia DSL modems using this process. I am able to read the welcome screen of the netopia telnet interface just fine however I can not get any further. The process manually goes like this: 1) Telnet to device ip 2) A welcome screen is displayed. 3) While on the welcome screen, press Control-N 4)