Sunday, July 28, 2013

WHMCS Hook - Trigger E-mail On New User Sign-Up

This script needs to go into your WHMCS hooks folder (root/includes/hooks/):


 function send_invitiation_email($vars) {

     $command = "sendemail";
$adminuser = "admin"; // Your admin username
$values["messagename"] = "Google Groups Invitation"; // exact name of e-mail template
$values["id"] =  $vars['userid'];

$results = localAPI($command,$values,$adminuser);




Wednesday, July 24, 2013

Bootstrap Form Builder

This looks great for non-technical users who want a form built. It's a great response to "Hey, make me a checklist!"...

"You make the checklist the way you want it using this site, then I'll put it on the web."

Friday, July 19, 2013

UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 12: ordinal not in range(128)

The error in the title will occur on pre-0.12.0 versions of python's Requests library. It seems to be fixed on later versions and maybe even earlier.

Here's an example of how you save a zip file from behind a corporate proxy with python's Requests library:

That's it! Just use the write function with the content of the returned request.

requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed

This happens with the Requests library in python. All you need to do is set verify=false.

For example:
cookieRequest =, data=json.dumps(payload).strip('"'), allow_redirects=False, headers=headers, verify=False)

src/pycurl.c:42:20: fatal error: Python.h: No such file or directory

The following helped to resolve this issue: sudo apt-get install python-dev

Wednesday, July 17, 2013

Writing To File - UnicodeEncodeError: 'ascii' codec can't encode characters

I was getting a lot of errors when I was trying to download a file with the python requests library. The errors looked like the following:
UnicodeEncodeError: 'ascii' codec can't encode characters in position 2-6: ordinal not in range(128)

This code ended up fixing it:

Monday, July 15, 2013

Prevent URL Encoding - Python Requests Library

Use json.dumps in the data parameter.

for example:
r =, data=json.dumps(payload), allow_redirects=False, cookies=cookieRequest.cookies)

Tuesday, July 9, 2013

Tunnel Traffic Through Webserver Using Your Browser

Use the following command in Cygwin (using your IP and Username, of course): 
ssh -D 2280 -i your/certificate

Set the following settings in Firefox (connect settings, under the advanced tab):

Dream Factory

It's suspiciously free. It's a ready to go back-end that can be accessed with APIs.

Tuesday, July 2, 2013

Easyphp Change Directory To Github

1. Right click on the easyphp icon --> configuration --> apache (this should open the httpd.conf in your easyphp apache directory)

2. Find the section labelled DocumentRootDirectory and overwrite with this:

# DocumentRootDirectory
<Directory "C:/Users/your_username/Documents/GitHub/your_project/">
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    # The Options directive is both complicated and important.  Please see
    # for more information.
    Options Indexes FollowSymLinks Includes ExecCGI

    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    AllowOverride All

    # Controls who can get stuff from this server.
    Require all granted


Setting Up Github Windows Client Behind a Proxy

1. Navigate to your git.exe directory (C:\Users\your_username\AppData\Local\GitHub\PortableGit~\bin)

2. git config --global http.proxy http://username:password@host:port/

3. git config --system http.sslcainfo /bin/curl-ca-bundle.crt

4. Open the github client (it should work now)