Sunday, August 12, 2012

Photoshop pixel perfect resizing

When resizing with the transform tool one has to select reference point accordingly in the transform toolbar. It defaults to center.

Another way is to add half of pixel.

Labels: , , ,

Friday, August 10, 2012

Backup your KeePass 2 database before saving it

KeePass 2 has a trigger system which you can use to backup your database before saving it. Here's how. Open KeePass window, select Tools -> Triggers... Click Add... Type in the name (like "Backup database on save"). On Events tab, click Add... and choose Saving database file from the dropdown menu. You can skip Conditions tab. On Actions tab click Add... again. Leave Execute command line / URL selected.
File/URL: %comspec%

Arguments: /c mkdir "C:\Users\username\Backup"

Wait for exit: Yes
This trigger will try to create a backup folder. You can specify whatever location you want for this. Click Add...again.
File/URL: %comspec%

Arguments: /c copy "{DB_PATH}" "C:\Users\username\Backup\{DB_BASENAME}.kdbx_{DT_SIMPLE}"

Wait for exit: Yes
This trigger will copy your database file to the backup folder with a timestamp appended. Now to avoid having thousands of database copies in a long time we can specify a trigger which will delete oldest copies. The one below will leave 10 backup files and delete the rest. You can change it to whatever number you like (orange number). So, on Actions tab click Add... again.
File/URL: %comspec%

Arguments: /c for /f "skip=10 tokens=*" %X in ('dir "C:\Users\username\Backup\{DB_BASENAME}.*" /b /o:-d') do del "C:\Users\username\Backup\%X"
Thanks to KeePass website. You can find more useful examples there.

Labels: , , , ,

Remove custom items from Firefox bookmark menu

If you want your Firefox bookmark menu to display only your own bookmarks without all those "Bookmark This Page" items, go to %AppData%/Mozilla/Firefox/Profiles/profilename/chrome and edit userChrome.css. If it's not there, just create it. Now paste this:
#menu_bookmarkThisPage,
#subscribeToPageMenuitem,
#subscribeToPageMenupopup,
#menu_bookmarkAllTabs,
#bookmarksShowAll, #organizeBookmarksSeparator,
#bookmarksToolbarFolderMenu,
#bookmarksToolbarFolderMenu+menuseparator,
#bookmarksMenuPopup menuseparator[builder="end"],
#menu_unsortedBookmarks { display: none !important; }

#BMB_viewBookmarksToolbar, #BMB_viewBookmarksToolbar+menuseparator,
#BMB_bookmarksShowAll, #BMB_bookmarksShowAll+menuseparator,
#BMB_bookmarkThisPage,
#BMB_subscribeToPageMenuitem,
#BMB_subscribeToPageMenupopup, #BMB_subscribeToPageMenupopup+menuseparator,
#BMB_bookmarksToolbar, #BMB_bookmarksToolbar+menuseparator,
#BMB_bookmarksPopup menuseparator[builder="end"],
#BMB_unsortedBookmarks { display: none !important; }

#appmenu_showAllBookmarks, #appmenu_showAllBookmarks+menuseparator,
#appmenu_bookmarkThisPage,
#appmenu_subscribeToPage,
#appmenu_subscribeToPageMenu,
#appmenu_subscribeToPageMenupopup, #appmenu_subscribeToPageMenupopup+menuseparator,
#appmenu_bookmarksPopup menuseparator[builder="end"],
#appmenu_unsortedBookmarks { display: none !important; }
The last part (in orange) will hide default items in Firefox appmenu bookmarks as well, so leave it out if you want to customize bookmark menu in  a toolbar only.

Labels: , , , , ,