Thursday, November 15, 2007
how to override google default font-family in firefox
@-moz-document domain(google.com)
{
body, td, input, textarea, select {
font-family: sans-serif;
}
}
Sunday, August 19, 2007
Friday, August 10, 2007
Use a Django project in a standalone script
simple in project directory~~from django.core.management import setup_environ
import settings
setup_environ(settings)
but this didn't work with python console or ipython with error ": Empty module name"
Wednesday, July 18, 2007
Howto: Install and configure LDAP Server (slapd) with TLS in Gentoo
1.1. Install openldap on gentoo
# emerge openldap pam_ldap nss_ldap
# chown ldap:ldap /var/lib/openldap-ldbm /var/lib/openldap-data /var/lib/openldap-slurp
1.2. /etc/openldap/slapd.conf
include /etc/ldap/schema/core.schema
include /etc/ldap/schema/cosine.schema
include /etc/ldap/schema/nis.schema
include /etc/ldap/schema/inetorgperson.schema
### "#echo rootpw `slappasswd -h {SSHA}` >> /etc/openldap/slapd.conf" to generate a password with SSHA crypt
password-hash {SSHA}
# Define SSL and TLS properties
TLSCertificateFile /etc/ssl/ldap.pem
TLSCertificateKeyFile /etc/openldap/ssl/ldap-key.pem
TLSCACertificateFile /etc/ssl/ldap.pem
database bdb # use bdb as backend database
suffix "dc=example, dc=com"
directory /var/lib/openldap-data
rootdn "cn=Manager, dc=example, dc=com"
rootpw {SSHA}ksjdlfjsdlfjslfkjsdlfjl
checkpoint 1024 5
# index
index cn,sn,uid pres,eq,approx,sub
index objectClass eq
# then setup access rules...:
access to attrs=userPassword
by self write
by anonymous auth
by dn.base="cn=Manager,dc=example, dc=com" write
by * none
access to *
by self write
by dn.base="cn=Manager,dc=example,dc=com" write
by * read
1.3. /etc/openldap/ldap.conf
BASE dc=example, dc=com
URI ldaps://server_host[change it to server]:636/
TLS_REQCERT allow
1.4. Genertate SSL certificate
# cd /etc/ssl
# openssl req -config /etc/ssl/openssl.cnf -new -x509 -nodes -out ldap.pem -keyout /etc/openldap/ssl/ldap-key.pem -days 999999
# chown ldap:ldap /etc/openldap/ssl/ldap.pem
1.5. Modify /etc/conf.d/slapd
OPTS="-h 'ldaps:// ldapi://%2fvar%2frun%2fopenldap%2fslapd.sock'"
1.6. Start slapd
/etc/init.d/slapd start
If success, with this command to test connection, "-d 5" is for debug:
ldapsearch -D "cn=Manager,dc=example,dc=com" -W -d 5
1.7. Autostart slapd service at Systemstart
rc-update slapd default add
1.8. Some issues
- command "slaptest" for verify slapd.conf
- if id3entry.bdb not found, try "slapadd"
- recover DB: db4.3_recover -h .
- useful log: /var/log/messages
Monday, July 16, 2007
zenity - display GTK+ dialogs
For example, zenity --question will return either 0 or 1, depending on whether the user pressed OK or Cancel. zenity --entry will output on standard output what the user typed into the text entry field.
Comprehensive documentation is available in the GNOME Help Browser, under GNOME/Utilities.
EXAMPLES
Display a file selector with the title Select a file to remove. The file selected is returned on standard output.
- zenity --title="Select a file to remove" --file-selection
Display a text entry dialog with the title Select Host and the text Select the host you would like to flood-ping. The entered text is returned on standard output.
- zenity --title "Select Host" --entry --text "Select the host you would like to flood-ping"
Display a dialog, asking Microsoft Windows has been found! Would you like to remove it?. The return code will be 0 (true in shell) if OK is selected, and 1 (false) if Cancel is selected.
- zenity --question --title "Alert" --text "Microsoft Windows has been found! Would you like to remove it?"
Show the search results in a list dialog with the title Search Results and the text Finding all header files....
- find . -name '*.h' | zenity --title "Search Results" --text "Finding all header files.." --column "Files"
Display a weekly shopping list in a check list dialog with Apples and Oranges pre selected
- zenity --list --checklist --column "Buy" --column "Item" TRUE Apples TRUE Oranges FALSE Pears FALSE Toothpaste
Display a progress dialog while searching for all the postscript files in your home directory find `echo $HOME` '*.ps' | zenity --progress --pulsate
devilspie
configuration files are in .devilspie folder, like firefox.ds. Code example:
(ifDetail description and syntax here: http://wiki.foosel.net/linux/devilspie
(is (application_name) "Firefox")
(set_workspace 2)
)
