Client certificates with urllib2

First let's get pem formatted file with certificate and key from your *.pkcs12 or *.pfx file with openssl.
openssl pkcs12 -in file.p12 -out file.pem -nodes


Now we need to extend standart HTTPSHandler( I found it here. I added timeout to getConnection method. ) and sent instance of it to urllib2's build_opener.
import urllib2, httplib
class HTTPSClientAuthHandler(urllib2.HTTPSHandler):
def __init__(self, key, cert):
urllib2.HTTPSHandler.__init__(self)
self.key = key
self.cert = cert
def https_open(self, req):
#Rather than pass in a reference to a connection class, we pass in
# a reference to a function which, for all intents and purposes,
# will behave as a constructor
return self.do_open(self.getConnection, req)
def getConnection(self, host, timeout=300):
return httplib.HTTPSConnection(host, key_file=self.key, cert_file=self.cert)

opener = urllib2.build_opener(HTTPSClientAuthHandler('/path/to/file.pem', '/path/to/file.pem.') )
response = opener.open("https://example.org")

print response.read()

Harmonica

Harmonica was one of things I want to have. It's small and sounds cool. I associate it with Wild West and cowboys.

A month ago I saw a harmonica in music store and I said myself to buy it.

Today I purchased another one than I saw. I didn't know types, how to play on it. The thing I assess was count of  holes )). I choose Yamaha SS 220.

I found that it needs to inhale too, not only blow )). It takes half an hour to understatnd positions of note and I played simple melodies.

Found some information on web about harmonicas. Type of mine is Chromatic Single. It has two rows of holes. Upper row gives C# scale and lower gives C scale. There are 44 holes, 22 on each row.

P.S. There, in Yamaha music store, I played on electronic drums. They're sooo coool. I wish them. Drums are compact it's important for my appartment. You control a volume and also they're pluggable to headphones. Aaaaaaa!!! I want I want  I want them. With my real drums I feel discomfort when I play cause of my neighbors and thin walls. Somebody, give me 1500 dollars!

message driven beans

Заюзали Message Driven Beans EJB 3.0.
Классное решение для работы с очередями.

В инете полно информации по нему, вдаваться в детали тут не имеет смысла, просто хвастаюсь :).

epay.kg

запарился писать на инглише. ну и его нафиг.

хочу рассказать о проекте epay.kg. это еще одна платежная система.
клиент почти весь на javascript с jquery.
именно для этого проекта я изучал data gridы. в результате чего, ни один грид мне не понравился и я написал свой... с классами Record, DataSource, XmlDataSource, Grid, Filter, Pager офигеть, да? )))


стырил у гмейла идею с выводом MessageBox и ErrorBox наверху,






вот такие вот дела

redirect to blogspot

I found that a lot of domain registrars with dns server don't allow to create CNAME to main domain (your-domain.com). You need to create subdomain (www.your-domain.com or blog.your-domain.com) for CNAME to ghs.google.com. .

It's good if you have homepage (your-domain.com) and blog(blog.your-domain.com).

But blogspot for me is homepage and blog )). So i redirect from your-domain.com to www.your-domain.com( CNAMEd ghs.google.com).

I use apache mod_rewrite and php.
.htaccess

RewriteEngine on
RewriteRule ^(.*)$ index.php?$1 [QSA,L]


index.php

<?php
error_reporting(0);
$uri = $_SERVER['QUERY_STRING'];
$uri = str_replace("index.php&", "", $uri );
$uri = str_replace("index.php", "", $uri );
header("Location: http://www.your-domain.com/{$uri}");
?>

Dissappeared sites which I developped


  • nph.kg site of Neman company

  • apteka.kg online drugstore of Neman company

  • ar.kg Asian Realty real estate agency

  • stroimarket.com.kg Building materials online-store

  • karabalta.org "Initiative Support Center" non-government organization

  • streetchild.net "Children Protection Center" non-government organization

  • asianroads.net "Asian Roads" travel agency