scripting

emacs lisp scripting optimization help request

狂风中的少年 提交于 2019-12-24 10:49:05
问题 I'm learning emacs lisp and I'm trying to script using it. I wrote a script and it works fine but I just think there are a lot of things I make in bash that I can do in emacs lisp instead. Big deal here: I'm not sure if my start-process works correct Please suggest / show me the lisp way of scripting on my script (as example) : #!/usr/bin/emacs --script (message "Vision synchronization \n") (let ((default-directory "/home/vision/")) (shell-command "git pull;") (princ (shell-command-to-string

Python3 search for input in txt file

两盒软妹~` 提交于 2019-12-24 08:57:10
问题 Basically what I want to achieve is this. I have a text file with only the word test in it. When the script is run it pops up with an input and the user would write test. That input is then checked to see if its in the text file and if it is, it would print works, and if that input isn't in the text file, it would print doesn't work. The code below is not working. When I type test as my input, I just received 9 lines in the terminal each saying doesn't work. As I said, the word test is the

TCL / Expect Scripting - Using a conditional statement to attempt a secondary login password

陌路散爱 提交于 2019-12-24 08:55:46
问题 I am very close to finish a TCL/TK app that logs into a Cisco Access Point via a serial connection (RS232} and gives it an IP address (very basic) However, I would like my script to attempt a secondary password if the first one fails This is how the Cisco CLI behaves with a serial connection when the incorrect password is entered 3 times (No User Name is needed, only prompts for a password) Password: Password: Password: % Bad secrets Again, if the default password of "Cisco" does not work, I

Make VIM function return text without indent

放肆的年华 提交于 2019-12-24 08:55:42
问题 I guess this question could be taken in two ways... (Generic) - is there a way to specify settings 'local' to a function ( setlocal changes seem to persist after the function call)... (Specific) - I have a function which gets called from an imap mapping (which takes a user input to pass into the function. The function works perfectly if I run set paste or set noai | set nosi either just before running my shortcut, or added into the function itself. The problem is, whichever way I do it, those

How do I convert the time to military time?

℡╲_俬逩灬. 提交于 2019-12-24 08:55:29
问题 I am getting input from a file. The time maybe military or standard (AM/PM) I need to convert the time to military. Here are some examples of the time in the CSV file 2011-08-16, 2:28:00 PM, 15:28 2011-08-16, 1:21:00 PM, 13:28 2011-08-16, 2:13:00 PM, 16:28 回答1: Firstly I'm not sure whether I understood the question correctly. Could be like this: Option Explicit Const SOURCE_PATH = "C:\source.csv" Const DEST_PATH = "C:\destination.csv" Dim oReg, oFso Set oReg = New RegExp oReg.IgnoreCase =

How do I convert the time to military time?

蓝咒 提交于 2019-12-24 08:55:07
问题 I am getting input from a file. The time maybe military or standard (AM/PM) I need to convert the time to military. Here are some examples of the time in the CSV file 2011-08-16, 2:28:00 PM, 15:28 2011-08-16, 1:21:00 PM, 13:28 2011-08-16, 2:13:00 PM, 16:28 回答1: Firstly I'm not sure whether I understood the question correctly. Could be like this: Option Explicit Const SOURCE_PATH = "C:\source.csv" Const DEST_PATH = "C:\destination.csv" Dim oReg, oFso Set oReg = New RegExp oReg.IgnoreCase =

wmctrl: moving a fullscreen window

南笙酒味 提交于 2019-12-24 08:39:52
问题 A small shell script should fix my ghosting-screen problem. I'm trying to move each window just 1px in a certain direction and in the following second it should do a move in the other direction back. #!/bin/bash while read windowId g x y w h deviceId windowTitle; do # ignore desktop screen if [ "${windowTitle}" != "Desktop" ]; then # ... # test values (fullscreen: not possible | window-mode: possible) `wmctrl -i -r ${windowId} -e 0,200,200,500,500` # ... fi done < <(wmctrl -lG) Is it possible

Powershell Script to run exe file with parameters

百般思念 提交于 2019-12-24 08:37:49
问题 I need script to run exe file with parameters. That's what I wrote, if there's a better way to do it? $Command = "\\Networkpath\Restart.exe" $Parms = "/t:21600 /m:360 /r /f" $Prms = $Parms.Split(" ") & "$Command" $Prms thanks 回答1: You have a couple options when running an external executable. Splatting $command = '\\netpath\restart.exe' $params = '/t:21600', '/m:360', '/r', '/f' & $command @params This method will essentially join your array as arguments to the executable. This allows your

Using Bash to determine if URL is HTTP or HTTPS

拟墨画扇 提交于 2019-12-24 08:34:13
问题 Is there a way In bash to determine if a URL uses SSL? Before I send anything else to the URL I want to find out if it only accepts HTTP or HTTPS connections. 回答1: You can use the below script if you have access to wget. #/bin/bash URL=google.com if wget --spider https://$URL 2>/dev/null; then echo "https is present" else echo "https not present" fi Please note that you need to have http_proxy / https_proxy set. I tested the above script in cygwin64 [dont have access to nix system as of now]

Using batch file to create IIS Virtual Directory from config file

与世无争的帅哥 提交于 2019-12-24 08:22:31
问题 I am creating an automatic deployment script and need to create an IIS Virtual Directory from the configuration file which is created when you Right-Click the virtual directory and select "All Tasks > Save Configuration to a File" Save Configuration To File http://img5.imageshack.us/img5/7200/saveconfigurationtofile.gif I have done some reading and know there is a script included with Microsoft Windows Server called "IISVDIR.VBS" but this doesn't seem to take this configuration file as an