command-line-interface

how to pass in the user-data when launching AWS instances using CLI

末鹿安然 提交于 2019-12-04 04:41:03
I'm using the AWS CLI to launch instances, and the command is: aws ec2 run-instances what i'm expecting is to pass in a script as the user-data. so, I did: DATA= base64 ./my_script on my Mac OSX, and then pass the DATA by: aws ec2 run-instances --user-data $DATA BUT, nothing happened after the instance launched So, how exactly should I do? Thanks!! Eric Hammond There is no need to base64 encode the data yourself. You can prefix a file name/path with file:// So, aws ec2 run-instances --user-data file://my_script or aws ec2 run-instances --user-data file:///full/path/to/my_script To pass the

How do Ruby and Python implement their interactive consoles?

眉间皱痕 提交于 2019-12-04 03:44:54
When implementing the interpreter for my programming language I first thought of a simple console window which allows the user to enter some code which is then executed as a standalone program as a shell. But there are severe problems: If every line of code the user enters is handled as a standalone program, it has to go through the tokenizer and parser and is then just executed by the interpreter - what about functions then? How can the Python/Ruby interactive consoles (IDLE, irb) "share" the code? How is the code entered handled? Example: >> def x: >> print("Blah") >> >> x() Where is the

PHP script won't run in the background

♀尐吖头ヾ 提交于 2019-12-04 03:44:02
问题 I am trying to run a php CLI script in the background and it just won't run - it has a status of Stopped SIGTOU (Trying to write output) - Here are the details Mac OS X Lion 10.7.2 PHP 5.3.6 with Suhosin-Patch (cli) (built: Sep 8 2011 19:34:00) I created a basic script test.php <?php echo 'Hello world'.PHP_EOL; ?> Here are the results of various tests:- php -f test.php (Hello world gets displayed) php -f test.php >test.log 2>&1 (Hello world gets put into test.log) php -f test.php >test.log 2>

How to disable Xdebug loading for PHP CLI? [closed]

泄露秘密 提交于 2019-12-04 03:20:41
Im using composer, and when i do an update. It takes a huge chunk of time if xdebug is loaded in my php.ini file. How can i disable xdebug only for cli. So composer won't take as much time. Yet i will have xdebug enabled? Xees I found the answer by specifying a custom php.ini file for apache, and left the original php.ini file for cli. in your apache configuration file. Just write the following bit of code. <IfModule php5_module> PHPINIDir "C:/PATH/TO/CUSTOM/INI" </IfModule> 来源: https://stackoverflow.com/questions/19894042/how-to-disable-xdebug-loading-for-php-cli

One-Shot Timers

本小妞迷上赌 提交于 2019-12-04 03:18:31
Dear Delphi programmers, I'm looking for help how to write a one-shot timer (No GUI, so VCL Timers out of question)... Let me explain a little bit more. In my code (explaining with VCL timer but in this particular project I have no forms): Call a procedure which send a char over serial port Enable a timer with a X amount of Interval In the OnTimer event: I have a code which send a char then disable the timer itself to never be executed again. The problem is that I need to make the creation of these timers dynamic. I thought of the function SetTimer() then KillTimer() in the "OnTimer event" to

How to get linux console $COLUMNS and $ROWS from PHP cli?

喜夏-厌秋 提交于 2019-12-03 22:23:47
I'm currently creating a new neat CLI library for PHP, and i'd like to figure out the width/height of the console it's running in. I've tried many things like digging through $_ENV, exec("echo $COLUMNS"), etc, but no result, while if i type echo $COLUMNS or $ROWS in bash commandline, it neatly displays the value. What do i need to do to access this value from PHP? I'm using .sh scripts like this: #!/usr/bin/php -q <?php require_once('lib.commandline.php'); class HelloWorld extends CommandLineApp { public function main($args) { echo('O, Hai.'); } } Update Final solution: public function

Python CLI to edit Firefox bookmarks?

十年热恋 提交于 2019-12-03 21:51:58
Has anyone done a Python CLI to edit Firefox bookmarks ? My worldview is that of Unix file trees; I want find /re/ in given or all fields in given or all subtrees cd ls with context mv this ../there/ Whether it uses bookamrks.html or places.sqlite is secondary -- whatever's easier. Clarification added: I'd be happy to quit Firefox, edit bookmarks in the CLI, import the new database in Firefox. In otherwords, database locking is a moot point; first let's see code for a rough cut CLI. (Why a text CLI and not a GUI ? CLIs are simpler (for me), and one could easily program e.g. mv old-bookmarks to

Why are both “true” and “false” tests true?

时光怂恿深爱的人放手 提交于 2019-12-03 20:53:16
The words "true" and "false" are special words (builtins) for bash. If used in an if test, they act as intuitively expected: $ if true; then echo "true"; else echo "false"; fi true $ if false; then echo "true"; else echo "false"; fi false However, this two tests: $ [[ true ]] && echo "true" || echo "false" true $ [[ false ]] && echo "true" || echo "false" true Both result in true. Why? [[ … ]] is, in this case, equivalent to test , i.e. test true and test false . Looking at the manual for test(1): -n STRING the length of STRING is nonzero STRING equivalent to -n STRING true and false are both

How to use git namespace to hide branches

老子叫甜甜 提交于 2019-12-03 20:28:05
问题 Background I'm working with a large team using git for version control. The normal flow is: People selecting a ticket from the "backlog queue". Working on the issue via a local branch (i.e. git checkout -b my_feature_branch ). Making several commits as they go (i.e. git commit ). Pushing local changes to a remote branch in order to "backup" their work so it lives on more than one machine, in case the laptop is damaged or stolen (i.e. git push -u origin my_feature_branch ). Eventually creating

Why does `ionic run ios` error with “No matching provisioning profile found”?

烈酒焚心 提交于 2019-12-03 17:28:35
问题 My goal is to run my Ionic app on my iPhone. I don't figure out what could be the reason explaining this exception: myIonicApp$ sudo ionic run ios Check dependencies === BUILD TARGET WealCome OF PROJECT WealCome WITH CONFIGURATION Debug === Check dependencies Code Sign error: No matching provisioning profile found: Your build settings specify a provisioning profile with the UUID “dabcc352-0b59-415a-bcd1-6f6ea1d1fbe6”, however, no such provisioning profile was found. CodeSign error: code