Wednesday, July 18, 2012

Using S3Cmd on Windows

1) Setup python 2.x - Python 3 is not supported.
2) Download s3cmd from
3) Add python directory to your global path (should be C:\python2x)
4) Run python install
5) Run python s3cmd --configure (from the build path)

You can edit the values in the setup configuration at c:\Users\"username"\AppData\Roaming\ in a file called s3cmd.ini

I'm using s3 with Greenqloud and if you download a the tarball from them you can replace the contents s3cmd.ini with _s3cfg from Greenqloud.
Then you can run commands
python s3cmd ls
Comment below if you run into trouble, I could try to help.

Adding permanently to path in Windows through console.

setx path "%PATH%"

where C:\cygwin\bin is the addition to the current path.

Friday, April 27, 2012

Simple way to backup code, zip and copy to dropbox

Download 7zip, add it to the path (or just copy the program files to C:\windows\)
Create a .bat file containing
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b)
echo %mydate%_%mytime%
md C:\temp\%mydate%_%mytime%
robocopy C:\myfoldertobackup\ C:\temp\%mydate%_%mytime%\ *.cs *.js *.aspx *.ascx *.master *.csproj *.sln *.bat *.html *.htm *.css *.sql /s
7z a c:\temp\dropbox\codebackup\ C:\temp\%mydate%_%mytime%
rmdir C:\temp\%mydate%_%mytime%\ /Q /S

Run it.
I would recommend dropbox or something similiar to upload the files to somewhere safe.
Be careful with the rmdir command, make sure you don't delete anything of value.

Wednesday, March 21, 2012

Pause in dos (.bat files)

For any MS-DOS or Windows version with a TCP/IP client, PING can be used to delay execution for a number of seconds.
If specified (-w switch), PING will wait for a number of milliseconds between two pings before giving a time-out.

PING -n 1 -w 60000 >NUL

Tuesday, March 20, 2012

Automatic submit on enter on input type=text ?

Depending on the browser, the Enter key may only cause a form submission if the form has exactly one text field, or only when there is a submit button present. The interface should not rely on a particular behavior for this key unless the issue is forced by observing the keypress event for presses of the Enter key.

so fix is add this
" input type="text" id="Text1" style="display:none;" /"

Friday, February 10, 2012

How to clone an entry in Filezilla Server.xml (create users from c#)

XDocument doc = XDocument.Load(pathtoxml);

XElement templatenode = doc.Descendants("User").SingleOrDefault(p => p.Attribute("Name").Value == "templateuser");

XElement newnode = new XElement(templatenode);
newnode.Attribute("Name").Value = "newusername";



Will create a clone of templateuser