I’ve created a small piece of Alfred extension that converts text to speech using OS X native support.
It’s really simple and useless!
Download: Say Something extension.
I’ve been using Password Generator extension by Don Southard for a long time. But I decided to create my own version/clone to generate more human-readable passwords.
I’ve created a new extension using this popular Python script by Pradeep Kishore Gowda, which let us generate passwords by combining letters and numbers, but generating patterns easy to remember.
Download: Nice Password Extension.
Today I was trying to setup a maintenance page for our main API that uses JSON. But the problem is that all our API calls are using POST, and Nginx doesn’t allows accessing static files using POST.
It simply serves a JSON file even accessing to any URL path.
By just adding this at the top of your settings.py:
import os here = lambda x: os.path.join(os.path.abspath(os.path.dirname(__file__)), x)
Then you can call: here(‘folder’) and automatically get the relative path to your project’s root plus folder name you pass as parameter.
For example, to set the templates folder:
TEMPLATE_DIRS = ( here('templates') )
Sometimes you need to test how mails are sent in a local environment without internet access, with this single line in Python you’ll see the mails how they should be delivered using a real mail server:
python -m smtpd -n -c DebuggingServer localhost:1025
It’s not a real SMTP server, because it never sends the email, but you can see in terminal how mail is sent, contents and headers.
I’ve spent some time trying to figure out how to import Google/Gmail Contacts to a web application I’m working on. It’s really easy, you’ve different ways and tools to do that.
But the problem is with the PHP version, because Google doesn’t provides an official client library, they just points you to Zend Gdata library, which is great, but some parts are missing (like in our case Contacts).
Another problem is to make secure calls, to avoid the warning message Google shows you at the moment of grant permissions to the library:
To solve this problem we need to make the Google connection secure, and for this we need to create our own private certificate and key.
In a *nix machine (Linux/Mac) you simply type in your Terminal:
(You can use your own data in the -subj, or leave it as it is, but you NEED to change the domain name, in this case ‘yourdomain.com’).
This will generate two privately signed files:
myrsakey.pem: which is your private key.
and myrsacert.pem: your certificate.
Now you need to register your domain in Google, to allow secure connections between your server and Google, without annoying warning messages. For this, go to: https://www.google.com/accounts/ManageDomains login with your Google Account, and then add the domain name in the box:
Then, go to Manage yourdomain.com, at the bottom of this page.
And in the first field enter the URL of the script that will login and get the contacts, for example: http://yourdomain.com/contacts.php
Next, we will add the certificate file we created in before (the one called myrsacert.pem) and click on Save. After that, you’ll notice that near the upload field a new message is added saying: We have a certificate for your domain.
Ok, ready for the domain management in Google.
Now, let’s see how the PHP version works.
First of all, we need to download Zend Gdata library. And add it to the same folder where you going to execute your PHP script. (Just upload the Zend folder, from the lib folder).
Also upload your private key, myrsakey.pem somewhere in your web server, and add the absolute path to the file in the line #40 of the script.
Ok, now, this is the example to fetch all the user’s contacts and print them to screen. It’s pretty well inline documented, and if you have any concern just leave me a comment.
I will post soon about Live and Yahoo! methods to get contacts.