27 April 2012

Multiple Google Drive (Do It Yourself)

Google head to cloud! started with Google Drive, a 5GB (free) file synchronization service application based on Python 2.6 and wxWidget (similar to dropbox). If you haven't notice it, google drive during startup extract itself into temporary folder (_MEI???) where python do its stuff.

How? well not too dissimilar from dropbox trick:

Download it first (I hate to download a downloader that claiming as installer, screw it!)
one of mirror:
http://v2.nonxt6.c.pack.google.com/edgedl/drive/1.0.2891.6813/gsync.msi

Once it installed "silently" you will find it in %PROGRAMFILES%\Google\Drive
I believe that's what you get if you're administrator

Copy all files, make a folder [somewhere] and paste there

Copy following text into notepad:

@ECHO OFF
:: NOT FOR EXPLOITATION!
SET USERNAME=Tukul
SET USERPROFILE=%~dp0%USERNAME%
MD "%USERPROFILE%\AppData\Roaming">nul
MD "%USERPROFILE%\AppData\Local\Application Data">nul
MD "%USERPROFILE%\Application Data">nul
MD "%USERPROFILE%\Local Settings\Application Data">nul
MD "%USERPROFILE%\My Documents">nul
MD "%USERPROFILE%\Documents">nul
START googledrivesync


Save above as "gdloader.bat" (you may change "Tukul" to anything else, just be descriptive) in [somewhere]
Run gdloader.bat,  You know what to do next!

make another copies if you want another Google Drive (be sure name different %USERNAME%)


Notes:
- Apparently when google do shell registration (shortly after finishing folder setup), Google Drive will nuke current account like crazy (at least in my XP) but that's okay, no worries
- As usual only one account that get file markings (checked icon etc...)
- Tested in XP go try yourself on other Windows!

15 April 2012

Statistics and Windows users

Not much to say this weekend so I make up this...

Looking at some statistics data sometime can be fun and give you some unexpected conclusion. Here is some trivia about this blog based on Google Analytics.

- "Borderline" article is always popular among Windows users, my two hackish article about two popular apps: sketchup and dropbox prove that. While dropbox article got linked many times the sketchup article traffic is barely came from Google search. Imagine if I wrote another similar hackish articles I bet this blog will no longer an open source blog. But I do intentionally lure visitors to peek on other articles (OSS) in the process however thats doesn't seems quite work according to statistics.

- Blogspot give you a bad name. At least thats what I felt in my country where majority blogs is aggregator or worse a duplicator :-) It's hard to believe the content of a blog is original even for myself. The abundant numbers of "peek and leave" visitors and the very low number of commenter come to mind. Even when the article is valid to their search.

- A portion of commenter and reader are Linux users despite linux platform represent less than 10% of total visitors! quite surprising. Ha ha see what a Windows diehard could attract :-)

- Decreasing Indonesian visitors, quite a sad fact. Somehow I believe I have good rank toward Indonesian googlers, but it's just open source + windows are very unpopular topic. Majority Indonesian open source users are IT students/graduates whom taught to use linux while the rest people like me have the Windows tendency. At some point I even consider to publish article in bilingual format to pump more native visitors but statistics say the targets here is by far lower than those developed countries such as Europe and US.

- Windows users don't/won't download unless something come with line: "This software has been scanned by forty something AV before uploaded even so you must scan it by yourself after download". I need to do comparison with others to came with this conclusion though. Thanks! this is the best heritage for becoming windows users. Be afraid people, be very afraid... virus is everywhere... Wow I must be very lucky still running XP with no active AV (just ClamWin) and still providing clean downloads ho ho.

- Open Source is the domain of developed countries (both developers and users). I hope I'm wrong but thats what the statistics say. Aside Japan/China which might have language barrier most visitors are US and Europe. Kind of irony but the reality show that crackers win the heart of most Windows users in developing countries. Piracy crushed open source in all sensible way :-)) I thought both are practically compatible...

04 April 2012

New mirror available at googlecode

Hi all, due to bandwidth issue that keep hitting this blog,  I decide to mirror several files to code.google.com/p/osspack32. I have use the command line uploader from google and seems I can handle small files myself but big files is will be kindly uploaded by ShoneCheung. If you want to be commiters (uploader) too please contact me.

Thanks

02 April 2012

Continued... PHP and nginx

Tonight I try to resume what I left yesterday: setting up php with nginx. I try to follow http://wiki.nginx.org/PHPFastCGIOnWindows, but since I have single exe php-cgi I would just copy it and php.ini into nginx folder. Thus use non-hardcoded path configuration:

Before that I have to comment about the RunHiddenConsole thing, in PE thingy this is just a matter of using -mwindows or -mconsole during compile. And there is a better tool called postw32 (from freepascal project, I included this in my mingw build) which could turn any console application into consoleless a.k.a "click and nothing seems to happened" (because it was already windowless) or vice versa (back to console again).

so inside conf\nginx.conf instead of:

root c:/www;

location ~ \.php$ {
fastcgi_pass 127.0.0.1:9123;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


I just need (merely replace /scripts with  $document_root  from stocked config):

location ~ \.php$ {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}


Both configuration assumed we have virgin php.ini (doc_root has empty value, do not confuse with nginx's   $document_root  above which translate root declaration before it that is "html" which refer to html folder relative to where nginx.exe located). In short we have portable configuration.

Now talk about respawning thingy... in the bottom part of the wiki before describe how to make it run under SYSTEM account. Well let me tell you something:
AFAIK we (as admin) could impersonate to SYSTEM using "at" (scheduler) command then kill "explorer.exe" just before launched and bang Windows P4WN3D and CHR00T3D! no no not that old trick, actually the proper way is to use "sc" command see below:

C:\Users\Administrator>sc create --help
Creates a service entry in the registry and Service Database.
SYNTAX:
sc create [service name] [binPath= ] ...
CREATE OPTIONS:
NOTE: The option name includes the equal sign.
type= (default = own)
start= (default = demand)
error= (default = normal)
binPath=
group= 
tag=  
depend=
obj= (default = LocalSystem)
DisplayName=
password=


Extra Extremely Important Note: That is an empty space right after equal sign and before the actual value.

Now we could even make php as service too that depends on nginx service, or run them under different credential (a hidden user preferably, you know like postgresql way). Nginx already have respawning (parent - child) facility adding it to relaunching service will increase its reliability more too.

Hmm.. I will make my own stack installer one day maybe came up with tagline: "Install and run in 5 seconds yet takes only 10MB of space" Yeah whatever, but I really hope this will become a fine release and get it's own page in the main menu of my blog. Certainly need more testing


It's Just Wrong: MSYS Python

I thought it would be helpful to have python which understand both posix path and windows path: MSYS version of python that is. In my old review about MinGW python, this kind of build already hampered with incompatibilities especially due to python heavily rely on inconsistent "defines" across modules sometime use uname() then sys.platform then posix or not (os.name).. meh.. this make workaround also inconsistent.

What did I tried is even worse:
- with uname = msys it's unknown system to python fine lets change it to cygwin, well this will create another problem since msys is not cygwin (different runtime unlike MinGW vs MSVC) its c modules should have different suffix to avoid python try to load native win32 module by accident (I set it to .myd meh...). Note: "msys" or "cygwin" or "mingw" is a hardcoded value that returned by sys.platform it can be only changed via hex editing once python.exe compiled
- distutils which used when building extension then would call uname (unlike mingw or msvc) to decide platform / compiler flags etc and what you get is insane name: MINGW32_NT-5.1-1.0.17(0.48/3/2) <- yes there even slashes there :-)
- unlike mingw build which can be changed to win32 (hardcodedly) to provide more compatibility thats not the case for msys which the only possible option is cygwin with above quirks.
- many c-extension tests failed! not really a problem if we just want barebone or purelibs though

In the end I decide to edit ntpath.py and site.py of native msvc python to make it use "/" under msys, this again have its own quirks too: win32 python need to use ";" as path separator which ":" already used as driveletter and because it doesn't know root "/". Meh...

Anyway here is the msys binaries of python 2.6.7: python-2.6.7_msys.7z (sources and patches from cygwin repo)

01 April 2012

NginX-svn4568 MinGW Win32

Want to test more my php-cgi (mingw build) last week but feel bothered to install/setup apache...

Building is quite straightforward, do not download from nginx.org instead take the svn trunk source code at svn://svn.nginx.org/nginx/trunk and modify ngx_atomic.h@24 to include defined __MINGW32__ then depends on which mingw api you use you may encountered conflicting off_t

$ configure --with-pcre=/local/php --with-zlib=/local/php --with-libatomic=/local/php --with-openss
l=/local/php --with-ipv6 --with-http_xslt_module --with-http_geoip_module --with-http_image_filter_
module --with-md5=auto/lib/md5 --with-sha1=auto/lib/sha1 --with-http_ssl_module --with-mail --with-
mail_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with
-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gzip_static_module --wit
h-http_random_index_module --with-http_stub_status_module --with-select_module


note:  --with-md5=auto/lib/md5 --with-sha1=auto/lib/sha1  not required if you have openssl

the configure/conf kind a odd though (or it just me?) that I need to edit the final objs/makefile from strayed path including changing NGX_PREFIX into "./" (hmm not sure about it, but kinda works)

Download:
nginx-svn4568.7z
Well at least I'm greeted with "Welcome to nginx!", time to set up with php... oh remind me old days!