Easy to use ‘touch’ command for windows/gui

I’m really used to being able to change timestamps from inside the unix shell. Occasionally I need to do this in Windows, and it’s not that simple to do. However, this tool brings right-clicking on a filename to change timestamps to your computer:

TouchPro by JD Design

TouchPro allows you to change any combination of file time attributes through a file’s property pages. It fully integrates into Windows Explorer giving you the ability to affect the timestamps of:

  • Individual files
  • The results of any file searches possible with Explorer. For example: particular file types, or for files within a date range.
  • Entire folder hierarchies

The registered version of TouchPro enables extra facilities:

  • Separate time & date modification.
  • Touch files and/or folders.
  • Touch read-only files and folders.
  • Save settings.
  • Time offset modification – useful if your computer or camera’s date is set incorrectly and you need files timestamps changing to the correct time.
  • Load the time from the timestamp of a file or folder, or from embedded time properties in pictures, email or Microsoft Office documents.
  • Select 24 hour time, and long or short date format.
  • Command line version.
  • Context menu operations to Touch with the saved settings, or the current time.

Force all web traffic to redirect to SSL (https) web server using .htaccess file

Here is the minimum amount of configuration needed to force all web traffic (port 80, http) over to https (port 443 via SSL).

1) Create a .htaccess file that looks similar to this one:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*) https://www.example.com/$1 [L]

and place it at the root of the web server directory where you want to redirect the traffic. Restart apache.

2) If that doesn’t work, you might need to modify your apache config file’s AllowOverride setting. If you were trying to use a .htaccess file just inside of the /var/www directory, you might need to edit /etc/apache2/sites-enabled/[name-of-your-site]

...
   <Directory /var/www/>
        ...
        Options FollowSymLinks
        AllowOverride FileInfo
        ...
   </Directory>

NOTE: Your web site might have other directives for Options and AllowOverride, but the 2 that I have show are the bare minimum to get the .htaccess file working.

Make vim “more readable” on black backgrounds

I pretty much live inside of putty/ssh. My defaults are a black background with white/light lettering. However, when I first get to a new system, I find that this is one of the first things that I need to change. Makes reading comments in code sooo much easier.

vim-before-background-dark

So, go ahead and modify /etc/vim/vimrc

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
"set background=dark

and remove the ” (double quote) from in front of set background=dark. This uncomments it, and makes that set vcommand visible to vi.

" If using a dark background within the editing area and syntax highlighting
" turn on this option as well
set background=dark

vim-after-background-dark

Changing the default editor from pico to vim

On new (or new to me systems) I find it annoying to use a program like git, or crontab -e and find myself in the pico editor.  🙁

So, here’s how to change it:

sudo update-alternatives --config editor

There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
* 0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
  3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    10        manual mode

Press enter to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/bin/vim.basic to provide /usr/bin/editor (editor) in manual mode.

and to confirm your selection, run the same command again, and check out the item that has the asterisk next to it:

sudo update-alternatives --config editor
There are 4 choices for the alternative editor (providing /usr/bin/editor).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /bin/nano            40        auto mode
  1            /bin/ed             -100       manual mode
  2            /bin/nano            40        manual mode
* 3            /usr/bin/vim.basic   30        manual mode
  4            /usr/bin/vim.tiny    10        manual mode

Press enter to keep the current choice[*], or type selection number:

If that still doesn’t work, try this instead:

export EDITOR=/usr/bin/vim.basic