Posts Tagged ‘windows’

Smart backup for your GMail account

May 28th, 2011 4 comments

There are a number of solutions out there that allow you to back up your Google mail, but all of them have some significant shortcomings. That’s pretty surprising given the popularity of GMail. BaGoMa aims to address all (or most) of them.

  1. BaGoMa is a command line application, so you can easily automate the backup. A GUI might be added in the future if there’s enough of a demand for it.
  2. It runs on all major operating systems: Linux, Windows, Mac OS X, basically anything that Python runs on. For Windows users the zip file even contains a stand-alone executable that has the Python interpreter and libraries built-in, so you don’t need to install anything else.
  3. It is open sourced, and contributions from the community are welcomed and encouraged. That also means you can read the source code  yourself to make sure your password and emails remain private.
  4. It has no arbitrary limitations on the tag/label names you can use in Google. Some other solutions out there expect you to only use ASCII. That means non-English users are out of luck. It even auto-detects the main types of folders in use so that it can skip folders such as “Spam” and “Trash”.
  5. Most importantly, it is tuned to work specifically with Google mail. There are a lot of generic applications that are able to backup an IMAP account. GMail however is not a true IMAP account. For example, if you apply 5 tags/labels to an email message, it shows up in 5 different IMAP folders. From the perspective of a regular IMAP application those look like 5 distinct messages, so they get backed up 5 times. It’s not clear what would happen when you attempt to restore your mail from such a backup. Will you end up with 5 identical copies of the message, each with a single tag/label, or will you end up with a single message that has 5 tags? BaGoMa does the right thing. In this case that means the message only gets downloaded (and backed up) once, and when restored all the original tags are applied to the same message.

The use of BaGoMa is extremely simple. To back up your account all you need is:


It works seamlessly with Google Apps for Business, so if you’re hosting your business email with Google you can use your business email address instead of to back up your business account. Please note that if you don’t specify a backup directory, BaGoMa will use a directory that matches your email address. Email addresses are case insensitive, but on operating systems with case-sensitive file systems you need to be consistent in how you write your email address, or specify the backup directory.

To restore your email you would run:

bagoma --action=restore

So what are you waiting for? Give it a try and stop worrying about forgetting your password and getting locked out of your account, or losing important emails if Google ever has an E-Mail outage.

BaGoMa homepage:

BaGoMa downloads:

BaGoMa documentation:

Categories: Uncategorized Tags: , , , ,

Windows proxy control script

December 2nd, 2010 No comments

Here’s a simple script that lets you toggle on or off your internet proxy in Windows. Save it to a file called Proxy.vbs on your desktop and double-click the file to execute the Despicable Me 3

As shown below, the script will not change the proxy server address, but will simply turn it ON or OFF. If you want to also modify the proxy server and exception list every time you turn it on, update lines 37 and 38, and uncomment lines 40-41.Watch Full Movie Online Streaming Online and Download

Parts of this script come from a comment someone posted on a web site, but I no longer have the link to provide proper attribution.


Const REG_SZ		= 1
Const REG_BINARY	= 3
Const REG_DWORD		= 4
Const REG_MULTI_SZ	= 7
Const HKCU_IE_PROXY	= "Software\Microsoft\Windows\CurrentVersion\Internet Settings"

Set oReg=GetObject("winmgmts:!root/default:StdRegProv")


Sub Main()
	buttons = vbQuestion + vbYesNoCancel + vbDefaultButton1

	If GetValue(HKCU,HKCU_IE_PROXY,"ProxyEnable",REG_DWORD) = 1 AND _
	Len(GetValue(HKCU,HKCU_IE_PROXY,"ProxyServer",REG_SZ)) > 0 Then
		' If Proxy is set then default to turning it off
		buttons = buttons + vbDefaultButton2
	End If

	choice = MsgBox("Enable the internet proxy?", buttons, "Proxy setting")
	If choice = vbYes Then
		SetProxy True
	ElseIf choice = vbNo Then
		SetProxy False
	End If
End Sub

Sub SetProxy(enabled)
	If enabled = False Then
		CreateValue HKCU,HKCU_IE_PROXY,"ProxyEnable",0,REG_DWORD
		MsgBox "Proxy Disabled", vbInformation, "Proxy OFF"
		strProxyServer = "MyProxySvr:80"
		strProxyOveride = "*;*;*"
		'CreateValue HKCU,HKCU_IE_PROXY,"ProxyServer",strProxyServer,REG_SZ
		'CreateValue HKCU,HKCU_IE_PROXY,"ProxyOverride",strProxyOveride,REG_SZ
		CreateValue HKCU,HKCU_IE_PROXY,"ProxyEnable",1,REG_DWORD
		MsgBox "Proxy Enabled and set to:" & vbcrlf & "(" & strProxyServer & ")", vbInformation, "Proxy ON"
	End If
End Sub

Function CreateValue(Key,SubKey,ValueName,Value,KeyType)
	Select Case KeyType
	Case REG_SZ
		CreateValue = oReg.SetStringValue(Key,SubKey,ValueName,Value)
		CreateValue = oReg.SetExpandedStringValue(Key,SubKey,ValueName,Value)
		CreateValue = oReg.SetBinaryValue(Key,SubKey,ValueName,Value)
		CreateValue = oReg.SetDWORDValue(Key,SubKey,ValueName,Value)
		CreateValue = oReg.SetMultiStringValue(Key,SubKey,ValueName,Value)
	End Select
End Function

Function DeleteValue(Key, SubKey, ValueName)
	DeleteValue = oReg.DeleteValue(Key,SubKey,ValueName)
End Function

Function GetValue(Key, SubKey, ValueName, KeyType)
	Dim Ret

	Select Case KeyType
	Case REG_SZ
		oReg.GetStringValue Key, SubKey, ValueName, Value
		Ret = Value
		oReg.GetExpandedStringValue Key, SubKey, ValueName, Value
		Ret = Value
		oReg.GetBinaryValue Key, SubKey, ValueName, Value
		Ret = Value
		oReg.GetDWORDValue Key, SubKey, ValueName, Value
		Ret = Value
		oReg.GetMultiStringValue Key, SubKey, ValueName, Value
		Ret = Value
	End Select

	GetValue = Ret
End Function
Categories: Uncategorized Tags: ,

CygWin terminal colors

November 14th, 2010 No comments

Many of the default ANSI colors used by the CygWin terminal are almost unreadable. For example, the blue that is used for directories in a file listing is pretty dark and hard to read on a black background. This limits the color palette that can be used in things such as the PS1 shell prompt. Try the following script ( to see what your colors currently look like.

The colors can be changed by clicking on the system menu in the upper-left corner and selecting “Properties”. I decided to use the same colors as the Gnome terminal.

This is how the colors are defined in CygWin by default:

Color R G B
Black 0 0 0
Blue 0 0 128
Green 0 128 0
Cyan 0 128 128
Red 128 0 0
Pruple 128 0 128
Brown 128 128 0
Light Gray 192 192 192
Dark Gray 128 128 128
Light Blue 0 0 255
Light Green 0 255 0
Light Cyan 0 255 255
Light Red 255 0 0
Light Purple 255 0 255
Light Yellow 255 255 0
White 255 255 255

This is how they should be changed so that they’re more usable:

Color R G B
Black 0 0 0
Blue 0 0 170
Green 0 170 0
Cyan 0 170 170
Red 170 0 0
Pruple 170 0 170
Brown 170 85 0
Light Gray 170 170 170
Dark Gray 85 85 85
Light Blue 85 85 255
Light Green 85 255 85
Light Cyan 85 255 255
Light Red 255 85 85
Light Purple 255 85 255
Light Yellow 255 255 85
White 255 255 255
Categories: Uncategorized Tags: , ,

Git on Windows

October 9th, 2009 No comments

One of the problems with using git on Windows is that it’s difficult to integrate it with other native (Windows) tools. That’s because the environment git runs in (cygwin or msysgit) refers to files by their UNIX name, but the Windows tools have no notion of where /tmp is for example (and that location can be different between cygwin and msysgit).

When doing an interactive rebase, the editor might be asked to edit a file such as /cygdrive/c/some/path/to/a/file. When doing a diff in git, one or both of the files to be diff’d might be placed by git in /tmp. Windows tools don’t understand such path names.

Fortunately, cygwin ships with a utility called cygpath that can be used to convert between UNIX and Windows paths. Msysgit doesn’t have this utility, but if cygwin’s /bin directory is in your Windows path, msysgit will pick it up and the scripts below will be usable for both cygwin and msysgit.

Here’s a script that can be used as a wrapper around your editor:


# Author: Gabriel Burca
# Script arguments:
# file-to-edit

FILE=`cygpath -w "${1}"`
"C:/Program Files/Vim/vim72/gvim.exe" "$FILE"
This script can be used as a wrapper around your diff tool:

# Author: Gabriel Burca
# Script arguments:
# path old-file old-hex old-mode new-file new-hex new-mode

# The old-file path is typically "/tmp/.diff_something" and windows programs
# don't know how to get to "/tmp"
# We use cygpath to convert to something windows programs understand.

OLD_FILE=`cygpath -w "${2}"`
NEW_FILE=`cygpath -w "${5}"`
"C:/Program Files/WinMerge/WinMergeU.exe" -e -ub "$OLD_FILE" "$NEW_FILE"
Finally, you'll need to modify ~/.gitconfig to use these scripts by adding something like this to it:
external = "C:/Utility/"
editor = "C:/Utility/"
Categories: Uncategorized Tags: , , , ,

Msysgit and vim

September 28th, 2009 No comments

The vim installation that comes with msysgit is missing a number of syntax file dependencies. In addition to what is installed by default, C:\Program Files\Git\share\vim\vim72\syntax should also contain diff.vim and nosyntax.vim. Without these vim will not display properly and will issue warnings that it’s unable to locate these files.

It looks like a fix has already been made (see this thread) but until it is released you can get these files directly from vim’s SVN repo: diff.vim and nosyntax.vim

Categories: Uncategorized Tags: , , ,