Entries tagged package

PHP Commandline Notification

Posted on 3. Januar 2018 Comments

When you run long (PHP) jobs it’s easy to forget about the terminal. That’s why I’ve created a small PHP package that will make a little sound. Because PHP itself doesn’t have this functionality anymore it’s possible to just echo the ASCII sign for BEL. Simply put this at the end of your PHP job:

use repat\CommandlineBell;
// flashes screen if possible, otherwise just bell()
CommandlineBell::flash();
// makes a beep sound
CommandlineBell::bell();

Under the hood it’s really just:
echo "0x07";

A good (non-PHP) alternative I found is brb by Viktor Fröberg, just run commands like this

php artisan migrate --seed ; brb

Of course it’s always possible to just run a TTS app on the commandline via exec() like this:

exec("say terminal task done");

Or you could do it similar to brb:

php artisan migrate --seed ; say seeding done

Source on GitHub

Use ssh-agent for atom.io remote-sync under MacOS

Posted on 22. Januar 2017 Comments

If you use the IDE atom.io with some sort of remote sync/scp/sftp package you can’t just use ssh-keys out of the box, if you set them up with a passphrase (which you should!). Here’s the 3 options most plugins offer:

  1. Use password (unless you disabled the option on the server)
  2. Use ssh-key
  3. Use ssh-agent

The problem with #2 is, that you would have to save your passphrase in a clear-text file which is never a good idea. But you can use the ssh-agent on MacOS the following way:

  1. create a ~/.ssh/config file
  2. add this line: AddKeysToAgent yes
  3. $ ssh-add .ssh/id_rsa
  4. restart atom

Using a Perl script because refactoring of a project with Android tools didn’t work

Posted on 20. Dezember 2014 Comments

I wanted to rename my project but I guess since it has a lot of dependencies that caused an error somewhere and I got the error message:

Refactoring
A fatal error occurred while performing the refactoring.
An unexpected exception occurred while creating a change object. See the error log for more details.

So I just the normal refactoring feature of Eclipse which not surprisingly also caused an error. After editing the AndroidManifest package entry, the import of the resources in the sources files didn’t work. It still said

import com.example.oldpackage.R

Only a couple of resource files needed manual editing but the Java files were a problem. What did the trick for me was this one-liner

perl -pi -w -e 's/import com.example.oldpackage.R/import com.example.newpackage.R/g;' `grep -r -l "import com.example.oldpackage.R"`

I realise this is rather quick&dirty (do a backup 😉 ) but it did work for this project. A short explanation:

perl

  • -pi puts the code in a loop (like -n, but sed-style)
  • -w gives you warnings
  • -e is one line of programm and since -pi
  • /g global, for all lines in the file

grep

  • -r recursive
  • -l give out files that matches the following search string

How to disable ACK with xbee-arduino API

Posted on 23. April 2014 Comments

It might be useful to disable all the ACK packages(0x8B) for testing purposes. That’s possible with all packages that inherit from XBeeRequest, my example shows a ZBTxRequest.

txRequest.setFrameId(NO_RESPONSE_FRAME_ID);