terminal

How to display modal window using osascript or AppleScript in OS X

你离开我真会死。 提交于 2019-12-21 21:53:53
问题 How to display modal(over all apps, windows) window using osascript or AppleScript in OS X 10.6.8 and later. Here a script I do: #!/bin/bash osascript -e 'tell app "System Events" to display dialog "My Dialog" buttons {"OK"} default button 1 with title "My Dialog" with icon caution' The problem is that it's not modal. How to fix the following issue? 回答1: I wrote a script recently to monitor my macbook battery when it got low. To make sure I didn't miss the alert I did the following... repeat

How to deactivate bash_history stats print when opening a new terminal window on my mac?

有些话、适合烂在心里 提交于 2019-12-21 21:39:14
问题 I just reinstalled MacOS (OSX 10.12) and as I'm redoing my IDEs and such I get this strange bash_history stats object that prints to every new terminal window! It's driving me bonkers, and after looking through all the preferences an settings I can't seem to turn it off! Does anyone know why this is suddenly happening? Is it something to do with iCloud Profile Syncing? Here's s picture below. Thanks so much for your help! Screenshot of bash terminal history stats Last login: Wed Jul 5 03:23

For loop after import doesn't work in Python one-liner

白昼怎懂夜的黑 提交于 2019-12-21 21:29:43
问题 If I use import and a for follows afterwards I get an invalid syntax error. I have no idea why this happens. > python3 -c 'import os; for a in range(1,5): print(a)' File "<string>", line 1 import os; for a in range(1,5): print(a) ^ Removing the import works fine: > python3 -c 'for a in range(1,5): print(a)' 1 2 3 4 or totally removing the for loop: > python3 -c 'import os; print(10)' 10 So what's going on?? 回答1: It's an error because it's not in the Python grammar. If you check out the syntax

npm start on new create-react-app build returns ELIFECYCLE error

本秂侑毒 提交于 2019-12-21 20:35:52
问题 Made a new react app using create-react-app and now getting the following error in the terminal when running npm start: > react-scripts start Attempting to bind to HOST environment variable: x86_64-apple-darwin13.4.0 If this was unintentional, check that you haven't mistakenly set it in your shell. events.js:167 throw er; // Unhandled 'error' event ^ Error: getaddrinfo ENOTFOUND x86_64-apple-darwin13.4.0 at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:57:26) Emitted 'error' event at:

Apple Dictation - Use in app

馋奶兔 提交于 2019-12-21 19:49:09
问题 Is there any way to utilize Apple's dictation voice to text abilities in native Apple application? 回答1: Your question is a little vague, it would be good to know what you have tried using or doing first, or eve what you are trying to achieve. More commonly found is keyword recognition API. But a speech recognition API that can be used for this is Open Ears. Along with that is Ceed Vocal. The first is free (Open Ears), but apparently Ceed Vocal give better results. EDIT If you want a speech

curl -F line break not interpreted correctly

我的梦境 提交于 2019-12-21 17:26:58
问题 I'm trying to send a notification via pushover using curl in a bash script. I cannot get curl -F to interpret the line break correctly though. curl -s \ -F "token=TOKEN" \ -F "user=USER" \ -F "message=Root Shell Access on HOST \n `date` \n `who` " \ https://api.pushover.net/1/messages.json > NUL I've tried: \n \\\n %A0 I'd rather push the message out directly, not through a file. 回答1: curl doesn't interpret backslash escapes, so you have to insert an actual newline into the argument which

How to definitely install virtualenvwrapper with Python3.5 on Mac OS Sierra?

与世无争的帅哥 提交于 2019-12-21 16:49:28
问题 Well, looking around here there are tons of questions about how to correctly installing virtualenvwrapper on Mac. I really tried all of them but for no avail. I've noticed the previous questions don't have the configuration like my computer, so here it is: Mac OS Sierra 10.12 Python3.5.2 installed from python.org installer for Mac OS This installation puts Python3.5.2 in this path: /Library/Frameworks/Python.framework/Versions/3.5/bin/python3 I've run python3 get-pip.py command to install pip

How to definitely install virtualenvwrapper with Python3.5 on Mac OS Sierra?

家住魔仙堡 提交于 2019-12-21 16:49:07
问题 Well, looking around here there are tons of questions about how to correctly installing virtualenvwrapper on Mac. I really tried all of them but for no avail. I've noticed the previous questions don't have the configuration like my computer, so here it is: Mac OS Sierra 10.12 Python3.5.2 installed from python.org installer for Mac OS This installation puts Python3.5.2 in this path: /Library/Frameworks/Python.framework/Versions/3.5/bin/python3 I've run python3 get-pip.py command to install pip

How to write an application that uses the terminal as GUI? (in C)

旧时模样 提交于 2019-12-21 16:21:34
问题 I'd like to write an application (in C) that uses the terminal of a *nix OS as its GUI. I mean an application of the kinds of emacs, vi etc. that take up the whole terminal window and jump back to the input prompt after quitting. How would you go about doing that, preferably in C? Can someone point me to a tutorial covering that? 回答1: You need to use ncurses: http://en.wikipedia.org/wiki/Ncurses http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ It is available on all major distros. 回答2: Well,

Terminal displays wrong php version (Snow Leopard)

空扰寡人 提交于 2019-12-21 15:33:37
问题 Need to downgrade php to 5.2.x, so I followed this tutorial: http://andreys.info/blog/2010-03-25/compile-php-5-2-on-osx-10-6-snow-leopard#comment-631 I'm on snow leopard 10.6.4, with xcode installed. So I compiled php5.2.x and completed the tutorial. phpinfo() loaded within the browser at htp://localhost says 5.2.x, Great!! But, Terminal command "php --version" says 5.3.x ?? While compiling/installing php5.2.x, the new module file replaced the php5.3.x module here: /usr/libexec/apache2