Sequentially number files

  • Number all PDF files in the directory (rename them like 001, 002, 003 … ) in bash:
a=1; for i in *.pdf; do new=$(printf "%03d.pdf" "$a"); mv -- "$i" "$new"; let a=a+1; done

Get Windows XP network information on command line

To display or set Windows XP network parameters (IP address, default gateway, DNS servers used, routing etc.) from the command line use netsh utility.

To see the list of options type:

  • netsh /?

Tunnelblick: access locally

You set up openVPN on Mac OS X with tunnelblick. You attempt to connect but get a message This file server is available on your computer. Access the volumes and files locally.

The problem may exist between the keyboard and the chair. Check if you are not connecting  to your own IP address instead of the server’s address.


Awkward

That awkward moment when you buy an Apple Mac computer just to realize that Yosemite Mac OS X sucks in comparison to the Linux Mint Mate you used before.


Disable attachments in Postfix

You have postfix mail system and you want to make it reject, delete or rename potentially dangerous attachments. NB: Before you start it is advised to make a backup copy of directory /etc/postfix/ .

1) Solution One

Quite simple one, without any extra installs.

  • Edit /etc/postfix/main.cf. At the end add single line:

mime_header_checks = regexp:/etc/postfix/mime_header_checks

  • Edit /etc/postfix/mime_header_checks. Create the file if it does not exist. At the end add single line:

/name=[^>]*\.(lnk|dll|shs|vbe|hta|com|vbs|js|jse|bat|cmd|vxd|scr|shm|pif|chm|zip|exe)/ REDIRECT admin@mydomain.me

This will redirect all incoming mail with the listed files to the indicated mail. You can also just reject such mails by writing REJECT instead of REDIRECT, followed by an optional  text message.

  • Reload the new postfix configuration:

postfix reload

2) Solution Two

A bit more sophisticated.

  • Install renattach.

sudo apt-get install renattach

  • Create user ‘filter’. It is recommended that it does not have neither password, nor home directory, nor login shell.

adduser –disabled-login –no-create-home –shell /bin/false filter

  • Edit /etc/postfix/master.cf. At the end add two lines:

filter unix – n n – – pipe flags=q user=filter argv=/usr/bin/renattach -l -p /usr/sbin/sendmail -i -f ${sender} — ${recipient} NB:

  1. The second line shall start with two spaces.
  2. Write full program names or you may get error with message “temporary failure. Command output: Error executing pipe command: sendmail “)
  • Edit again /etc/postfix/master.cf. Find at the top of the file the section which looks like:

# ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ==========================================================================

smtp inet n – – – – smtpd

And add this line under it:

-o content_filter=filter NB:

  1. The line shall start with four spaces.

If there are already some other options, you may add it under them all, e.g.:

smtp inet n – – – – smtpd
-o content_filter=spamfilter
-o receive_override_options=no_address_mappings
-o content_filter=filter

  • Edit configuration file /etc/renattach/renattach.conf:

Go to the bottom of the file and uncomment badlist lines. You can add extra your own lines if you want, e.g.

badlist = ZIP

Also, change the message in the subject of the processed message, e.g.:

add_subject = [Suspicious attachments renamed]

Or invent your own extension for the renamed files, e.g.:

new_extension = suspicious

  • Reload the new postfix configuration:

postfix reload

Enjoy extra protection!

Both Solutions as they are described here do not work together, because the Solution One will be first to get to the mail and it will never make it to the renattach. So you have to choose either one of them.


Move and snap object to another object in Blender

Situation: We have an object (a cube) which we want to move and stick it precisely to a particular point at another object (another cube).

AutoCAD analogue: We have two boxes. We say move, select one box, choose as the point of reference intersection at a corner, then move the box with object snap to the intersection at a corner of another box.

How to do it in Blender:

Basically we are playing with two elements here:

  • POINT OF ORIGIN of the object, the miniature orange ball you can see for the object which is selected. It is our “reference point” for operations with the object.
  • CURSOR, the little red-white dashed ring with the black cross (and not the bigger white ring with 3d axis attached, that is the 3D Transform Manipulator).

The basic idea is that we strategically place the cursor somewhere at the scene, and then tell Blender to move the object so that its point of origin coincides with the cursor. Obviously, the strategic placement of the cursor in this context means placing it at the corner of the box to snap to.

We have our two cubes.

01

Click right on the cube on the left to select it.  Read the rest of this entry »


Export layers as files in Gimp

You can’t export layers as separate files in Gimp using the default setup, but you can add a plugin for this.

Works with Gimp 2.8 and above.

Just copy the “export_layers.py” file and the subdirectory “export_layers” with other .py files into your gimp plugin directory (e.g. “/home/user/.gimp-2.8/plug-ins”) and Gimp will load the plugin at the next start.

Then look for

  • File-> Export Layers..

and

  • File-> Export Layers to

Follow

Get every new post delivered to your Inbox.