Generating nice and ordered random names

You may want to generate random names, ordered by alphabet, which sound nice, instead of using total random gibberish or, on the opposite, using standard “alpha”,”bravo” etc. naming convention.

This may be useful for naming product versions or any other purpose where you need a sequential indexing of items.

One solution is to use wordoid.com, enter the first letter in accordance to your current version, and pick one name to your liking from the generated results.

Advertisements

Photoshop PSD thumbnailer for Gnome file manager

This script generates a system script and associated meta-information for displaying Adobe Photoshop .PSD image thumbnails in Gnome file manager. It is intended to work with Nautilus, but also works with Nemo in Linux Mint 18.2 Sonya Cinnamon, even though “Add GConf Hooks” section of the script fails.

Run the script with sudo and reboot afterwards.

The script was acquired from askubuntu.com here, and it is actually preferable that you get it from there, because here it may be automatically reformatted and fail at execution. It is posted here only for archival purposes.


#!/bin/bash

# ———————————————————–
# — Write psdthumbnailer
# ———————————————————–
OUTFILE=/usr/lib/psdthumbnailer
(
sudo cat <<‘EOF’ # bin/bash # Arguments / Parameters %i %o %s f_in=$1 f_out=$2 f_size=$3 # Execute Convert PSD to PNG through ImageMagick exec convert “psd:$f_in[0]” -scale “$f_sizex$f_size” “png:$f_out” EOF ) > $OUTFILE
# ———————————————————–
# — Write photoshop.thumbnailer
# ———————————————————–
OUTFILE=/usr/share/thumbnailers/photoshop.thumbnailer
(
sudo cat <<‘EOF’ # bin/bash [Thumbnailer Entry] TryExec=/usr/lib/psdthumbnailer Exec=/usr/lib/psdthumbnailer %i %o %s MimeType=image/vnd.adobe.photoshop; image/x-photoshop; image/x-psd; EOF ) > $OUTFILE
# ———————————————————–
# — Set File Permissions
# ———————————————————–
sudo chmod 0755 /usr/lib/psdthumbnailer
sudo chmod 0644 /usr/share/thumbnailers/photoshop.thumbnailer

# ———————————————————–
# — Add GConf Hooks to parse thumbnails
# ———————————————————–
sudo gconftool-2 –set /desktop/gnome/thumbnailers/image@vnd.adobe.photoshop/enable –type bool true

sudo gconftool-2 –set /desktop/gnome/thumbnailers/image@vnd.adobe.photoshop/command –type string “/usr/lib/psdthumbnailer %i %o %s %i %o %s”

# ———————————————————–
# — Install Dependencies
# ———————————————————–

sudo apt-get install imagemagick


Run a process in VirtualBox from outside

You can launch a program within an Oracle VirtualBox virtual machine from the host system’s command prompt.

Example 1:  Run notepad in MS Windows 7 virtual machine named “7” as user “user” with password “1” from Ubuntu:

  • VBoxManage guestcontrol "7" run --exe "C:\\Windows\\notepad.exe" --username user --password 1

Example 2: Output guest network info:

  • VBoxManage --nologo guestcontrol "7" run --exe "c:\\windows\\system32\\ipconfig.exe" --username user --password 1 --wait-stdout

Notes:

  • You must have Guest Additions installed
  • The user account must have a password

Disable VirtualBox clock synchronization

For whatever reason you may want to disable the time/date synchronization between the VirtualBox guest system and the host OS.

See the example below to do that for an example virtual machine “myName”:

  • vmname=”myName”; printf “Disabling clock sync for vm: \”$vmname\”\n”; VBoxManage setextradata $vmname “VBoxInternal/Devices/VMMDev/0/Config/GetHostTimeDisabled” 1; VBoxManage setextradata $vmname “VBoxInternal/TM/TSCTiedToExecution” 1;

Unfortunately this is ignored when the virtual machine is shut down and then started again. The clock of the virtual machine will be forcefully synchronized to the host system clock. If you know a workaround, please post it in comments.


Input line is too long

So you create a .bat file with a long list of arguments and it fails with a message:

“the input line is too long”

To avoid this, split your long single line into multitude of shorter lines separated by the caret character to mark the line break. Like this:

echo 1^
 2^
 3

 


Error – getcwd failed!

You run a command on command line and receive a mysterious error message:

sh: 0: getcwd() failed: No such file or directory

Possible explanation is that the directory you were working in has been deleted by some other process and indeed just does not exist anymore. Move, for example by typing “cd”, and continue working elsewhere.


Invalid command RewriteEngine

After (re-)installation of Apache2 the browser greets you with error 500 “Internal Server Error” and Apache2 error log file contains message “Invalid command ‘RewriteEngine’, perhaps misspelled or defined by a module not included in the server configuration”.

Well, you might want to enable mod_rewrite, which is disabled by default:

  • a2enmod rewrite
  • service apache2 restart