x64Architecture

Make HotKey for the Command Prompt (Windows)

Since i’m a big fan of Debian and Ubuntu and I liked the CTRL+ALT+T HotKey (open terminal) feature I figured why not make one for Windows to, so I made this little project in C, CmdHotKey, when you open the application it runs in the background, and when you press the CTRL+ALT+T HotKey it opens the command prompt and when you press the CTRL+ALT+Q HotKey it terminates the program.

Link to source: here Link to binaries: here

Wnmp 2.0.3 Released!

Windows, Nginx, MySQL & PHP(Wnmp)

Wnmp 2.0.3
**********
- Wnmp Control Panel 2.0.8

  * Faster control panel startup(0.15348 vs. 0.183).
  * Windows XP/2003 support dropped.
  * Added Windows version definitions for Windows 8.1 and Windows Server 2012 R2.
  * Added control panel updater and changelog viewer and fixed some minor bugs.
  * Removed the border around the icon.
  * Various fixes and improvments.

- PHP

  * Updated to 5.5.6

- phpMyAdmin

  * Updated to 4.0.9

Mercurial 2.7.1

Notice: This is a bug check here for more information. If any of you use Mercurial for windows or any other platform and updated to version 2.7, you'l notice that you can’t use TLS v1 connections anymore and your forced to use SSL v3 connections to connect to a HTTPS Mercurial repository so I compiled mercurial for Windows with a patch to force TLS v1, here is the link to the one word patch. So because on windows compiling things is a lot of work especially for a one line change, I compiled Mercurial with the patch, here are the download links:

32 bit Mercurial: Version 2.7.1 MD5: 272a571679d2dd4fee8b21b6d5a104d7 SHA-1: ccfbe85f2f6cedb31364cc3b38f1ee62c2c73d0a

64 bit Mercurial: Version 2.7.1 MD5: 266fbead1406384a3eaf899c173674bb SHA-1: 2d3b17b656f2a2bcdde9df7ada6ee681524c3b7c

Running Hgweb With Nginx and uWSGI

As you probably noticed I have been messing around with mercurial and saw 502, 404, 403, etc. errors everywhere on hg.x64architecture.com. It took me a while to figure out how to setup mercurial and a lot of tutorials were outdated and they were for fast-cgi, cgi, proxying, etc. which are slower then uWSGI so I wanted to use uWSGI, I figured i’d make a tutorial to help someone out.

I’m using Ubuntu 12.04 as my Linux Distribution.

First off we have to fetch the required packages:

$ sudo apt-get install python-software-properties     (Optional)
$ sudo add-apt-repository ppa:kurtcancemi/nginx       (Optional)
$ sudo apt-get update
$ sudo apt-get install mercurial python-pygments nginx nginx-common nginx-full uwsgi uwsgi-plugin-python apache2-utils

You can optionally make a hg user and group:

$ sudo /usr/sbin/groupadd hg
$ sudo /usr/sbin/useradd -g hg -s /bin/false hg
$ sudo chown hg:hg /var/hg
$ sudo /usr/sbin/usermod -G hg www-data

Create a directory for the hgweb configuration file. Change the path to whatever you would like.

$ sudo mkdir -p /var/hg

The mercurial package ships with a WSGI file which we will use.

$ sudo cp /usr/share/doc/mercurial/examples/hgweb.wsgi /var/hg/

Edit hgweb.wsgi and set the path of the hgweb configuration file. You could apply this patch if you want by saving it as hgweb.patch and entering patch -p1 < hgweb.patch

--- hgweb.wsgi 2013-05-27 01:36:28.835575809 -0400
+++ hgweb.wsgi  2013-05-27 01:37:49.023575136 -0400
@@ -2,7 +2,7 @@
 # See http://mercurial.selenic.com/wiki/modwsgi for more information

 # Path to repo or hgweb config to serve (see 'hg help hgweb')
-config = "/path/to/repo/or/config"
+config = "/var/hg/hgweb.config"

# Uncomment and adjust if Mercurial is not installed system-wide # (consult “installed modules” path from ‘hg debuginstall’): Change the configuration to your needs: /var/hg/hgweb.config

[web]
; allow push
allow_push = *
; Base url
baseurl = /
; makes it easier to serve static assests via nginx instead of python
staticurl = /static
; allow archive download
allow_archive = gz bz2 zip

[paths]
; the path to your mercurial repository
repo = /var/hg/YOURREPO
; repo1 = /var/hg/YOURREPO

[extensions]
; pretty colors (optional)
hgext.highlight =

Create a uwsgi application configuration file.

/etc/uwsgi/apps-available/hgweb.ini

[uwsgi]
processes = 2
socket = unix:/run/hgweb.sock
chdir = /var/hg
wsgi-file = hgweb.wsgi
uid = hg
gid = hg

Enable the uwsgi hg application.

$ sudo ln -s /etc/uwsgi/apps-available/hgweb.ini /etc/uwsgi/apps-enabled/

Start uWSGI.

$ sudo service uwsgi restart

Now we have to configure a virtual host for Nginx.

/etc/nginx/sites-available/hgweb

server {
    # server name
    server_name hg.example.com;

    # logs(optional)
    access_log /var/hg/log/access.log;
    error_log /var/hg/log/error.log;

    location / {
        limit_except GET HEAD {
      auth_basic                  "Mercurial Repository";
      auth_basic_user_file        /var/hg/mercurial_users;
      }
      include     uwsgi_params;
      uwsgi_param REMOTE_PORT     $remote_port;
      uwsgi_param SERVER_PORT     $server_port;
      uwsgi_param SERVER_PROTOCOL $server_protocol;
      uwsgi_param UWSGI_SCHEME    $scheme;
      uwsgi_param SCRIPT_NAME     /;
      uwsgi_param AUTH_USER       $remote_user;
      uwsgi_param REMOTE_USER     $remote_user;
      uwsgi_pass  hg;
    }

    # serve static assests through nginx(faster) and not python.
    location /static {
        alias /usr/share/mercurial/templates/static;
    }
}
upstream hg {
  server unix:/run/uwsgi/app/hgweb/socket;
}

Enable the Nginx virtual host.

$ sudo ln -s /etc/nginx/sites-available/hgweb /etc/nginx/sites-enabled/

Generate user and password for pushing to the repo

$ sudo htpasswd -c /var/hg/mercurial_users YOURUSERNAME

Check for errors in /etc/nginx/sites-available/hgweb:

$ sudo service nginx configtest

If there are no errors then reload Nginx:

$ sudo service nginx reload

Project Repository

I have just created a project repository if you would like to visit it, check it out here (If you want to use an SSL secured version your going to have to follow these instructions). All of my new projects will be posted there. Currently Wnmp is hosted there but its main project page is at Google Code.

Wnmp 2.0.2 Released

Windows, Nginx, MySQL & PHP(Wnmp)

Changelog:

Wnmp 2.0.2
**********
Enhancements:

* Lots of GUI changes

* Added option to view logs inside the GUI

* Added option to edit the config inside the GUI

* Added the applications statuses inside the GUI

* Added an output box inside the GUI

Updates:

* PHP now in version 5.4.15

* Nginx now in version 1.4.1
  - Security: a stack-based buffer overflow might occur in a worker
    process while handling a specially crafted request, potentially
    resulting in arbitrary code execution (CVE-2013-2028).

* phpMyAdmin now in version 4.0.0