command-line

What are my available march/mtune options?

时光总嘲笑我的痴心妄想 提交于 2021-02-08 12:22:47
问题 Is there a way to get gcc to output the available -march=arch options? I'm getting build errors (tried -march=x86_64 ) and I don't know what my options are. The compiler I'm using is a proprietary wrapper around gcc that doesn't seem to like -march=skylake . The flags should be the same so I assume whatever options I'd send to gcc to dump architectures would be the same for this wrapper. I managed to cause gcc to error with a bogus parameter and it dumped a list, but I'm not seeing that now

How to run Octave code without the Octave IDE (similarly to Python)? [duplicate]

佐手、 提交于 2021-02-08 09:50:29
问题 This question already has answers here : Octave: How to prevent plot window from closing itself? (2 answers) Closed 2 days ago . Context: When I use Python + matplotlib, I can compose the code in any text editor (like Sublime Text), do CTRL + B , and then the text output appears in the "Build results" panel of the text editor, and, optionally, graph/plots are rendered in a new GUI window. Under the hood, the text editor calls python myscript.py when we do "Build", and that's it. It's simple

Passing Python JSON argument with whitespace

烈酒焚心 提交于 2021-02-08 09:32:42
问题 I am trying to pass JSON as an argument to python script in command prompt. It works if the element in JSON does not have white spaces in value but it does not work if there are white spaces. Here is script import json, sys, traceback if(len(sys.argv)>1): print(sys.argv[1]) jsonInput = json.loads(sys.argv[1]); print(jsonInput['name']) print(jsonInput['kingdom']) print(jsonInput['slogan']) Passing below JSON as an argument in the power Shell. I have spaces in values e.g. Jon Snow python C:

Passing Powershell variable to Windows Batch file

五迷三道 提交于 2021-02-08 09:16:30
问题 Due to restrictions around my project and how this is being deployed, I need to run a powershell command in a batch file and echo a variable from the powershell script. This scripts retrieves a model number from a TV over RS-232 and returns the model in HEX. I wrote the script and meticulously condensed it to one line that runs. I can even 'powershell -command "[myCondensedScript]"' in the command line and it works great for /F %%a in ('powershell.exe -command "$port = New-Object System.IO

sed: remove whole words containg a character class

蓝咒 提交于 2021-02-08 08:20:18
问题 I'd like to remove any word which contains a non alpha char from a text file. e.g "ok 0bad ba1d bad3 4bad4 5bad5bad5" should become "ok" I've tried using echo "ok 0bad ba1d bad3 4bad4 5bad5bad5" | sed 's/\b[a-zA-Z]*[^a-zA-Z]\+[a-zA-Z]*\b/ /g' 回答1: Using awk : s="ok 0bad ba1d bad3 4bad4 5bad5bad5" awk '{ofs=""; for (i=1; i<=NF; i++) if ($i ~ /^[[:alpha:]]+$/) {printf "%s%s", ofs, $i; ofs=OFS} print ""}' <<< "$s" ok This awk command loops through all words and if word matches the regex /^[[

how to automatically write curl output to a new file

末鹿安然 提交于 2021-02-08 07:43:22
问题 I am using cURL to retrieve stock information back to the terminal window on my Mac using the yahoo finance api. i.e. I type: curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=l1' and it prints the output (in this instance the last trade price in the command line) It works terrific, but I would like to know how to get this output automatically written to a stock.txt file located on my desktop without any manual intervention upon the execution of the original cURL command. Thus

what does “..”(DotDot) mean in “cd..” command in powershell? [closed]

淺唱寂寞╮ 提交于 2021-02-08 07:30:10
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 1 year ago . Improve this question I already know what it does. it simply goes one directory or folder backwards . But what's mysterious for me are those two dot. cd.. #it has the same function as popd with the difference that it changes the #current working directory if someone tell me what is

How not to quote argument in subprocess?

你。 提交于 2021-02-08 06:19:59
问题 I'm trying to call an ImageMagick command from Python 2.7 using subprocess.call. My problem is that the argument parser in subprocess puts a double quotation mark around every argument, and ImageMagick seems to have a problem with quotes around non-file arguments. What I'd like is something like this "imagemagick.exe" "im1.png" "im2.png" -alpha off ( ... ) -composite "im3.png" So far I couldn't find a way to do it with subprocess, other than manually constructing the string with ugly + " " +

How not to quote argument in subprocess?

自古美人都是妖i 提交于 2021-02-08 06:19:16
问题 I'm trying to call an ImageMagick command from Python 2.7 using subprocess.call. My problem is that the argument parser in subprocess puts a double quotation mark around every argument, and ImageMagick seems to have a problem with quotes around non-file arguments. What I'd like is something like this "imagemagick.exe" "im1.png" "im2.png" -alpha off ( ... ) -composite "im3.png" So far I couldn't find a way to do it with subprocess, other than manually constructing the string with ugly + " " +

What is the Windows command line parameter encoding?

爷,独闯天下 提交于 2021-02-08 05:57:12
问题 What encoding does Windows use for command line parameters passed to programs started in a cmd.exe window? The encoding of command line parameters doesn't seem to be affected by the console code page set using chcp (I set it to UTF-8, code page 65001 and use the Lucida Console font.) If I paste an EN DASH, encoded as hex E28093, from a UTF-8 file into a command line, it is displayed correctly in the cmd.exe window. However, it seems to be translated to a hex 96 (an ANSI representation) when