Author Archives: Berend de Jong

The Gimp: create 3D Text

Create a 3d text; simple and fast with The Gimp

  1. Create a new image
  2. Add some text
  3. Duplicate the text layer
  4. Select menu “Filters”; select “Blur”; select “Motion Blur”
  5. Enable blur type “Zoom”
  6. Set X and Y properties
  7. De-select “Blur outward”
  8. Set length to about 15
  9. Select “Ok”
Share

Configure Apache

Perform a clean Apache install:

sudo apt-get install apache2

After that copy original configuration files:

cp /etc/apache2/apach2.conf /etc/apache2/apache2.conf.org
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default.org
cp /etc/apache2/sites-available/default-ssl /etc/apache2/sites-available/default-ssl.org

To prevent users from getting a directory listing add the next line to the bottom of your apache2.conf:
Options -Indexes

A fresh apache install has the following modules installed

apachectl -t -D DUMP_MODULES
Loaded Modules:
core_module (static)
log_config_module (static)
logio_module (static)
version_module (static)
mpm_prefork_module (static)
http_module (static)
so_module (static)
alias_module (shared)
auth_basic_module (shared)
authn_file_module (shared)
authz_default_module (shared)
authz_groupfile_module (shared)
authz_host_module (shared)
authz_user_module (shared)
autoindex_module (shared)
cgi_module (shared)
deflate_module (shared)
dir_module (shared)
env_module (shared)
mime_module (shared)
negotiation_module (shared)
php5_module (shared)
reqtimeout_module (shared)
setenvif_module (shared)
status_module (shared)
Syntax OK

As you can see the rewrite module is missing from this list. You can simple active this module by executing:

a2enmod rewrite

 

 

Share

Add SSL to localhost on apache / linux

Generate a Certificate Signing Request

1. Generate the keys for the Certificate Signing Request (CSR)

openssl genrsa -des3 -out server.key.secure 1024

2. Create the insecure key.

openssl rsa -in server.key.secure -out server.key.insecure

3. Create the CSR.

openssl req -new -key server.key.insecure -out server.csr

Fill in the appropriate information.

4. Create the self-signed certificate

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

This creates server.crt

5. Install the self-signed certificate

sudo cp server.crt /etc/ssl/certs
sudo cp server.key /etc/ssl/private

Now you can configure apache with the ability to use public-key cryptography to use the certificate and key files.

Configure Apache to use SSL on local host

6. Enable ssl

sudo a2enmod ssl

7. Edit your default-ssl site (make backup copy)

Change:

SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem
SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key

To:

SSLCertificateFile /etc/ssl/certs/server.crt
SSLCertificateKeyFile /etc/ssl/private/server.key

8. Enable the default-ssl site.

sudo a2ensite default-ssl

8. Restart the server.

sudo service apache2 restart

Navigate to https://localhost and examine your certificate details

Share

chmod to the max

Short and simple chmod reference. Use numbers to set file permissions.

400 read by owner
040 read by group
004 read by anybody (other)
200 write by owner
020 write by group
002 write by anybody
100 execute by owner
010 execute by group
001 execute by anybody

Make file readable for owner:
readable (4) owner = 400 => chmod 400 fname

Make file readable and writeable for owner:
readable + writeable (4 + 2) owner = 600 -> chmod 600 fname

Make file readable and writeable for group:
readable + writeable (4 + 2) owner = 60 -> chmod 60 fname

Make file readable and writeable for anybody:
readable + writeable (4 + 2) owner = 6 -> chmod 6 fname

Examples

# Set file permission to-rwxr-xr-x
# Read Owner 400
# Read Group 40
# Read Other 4
# Write Owner 200
# Write Group 100
# Write Other 010
# Exec  other 001

# Total = 400+040+004+200+100+010+001 = 755

chmod 755 thefile.cgi

# Read and write by everyone (444 + 222):

chmod 666 file.txt

# Change all directories to rwx by everyone:

find . -type d -exec chmod 777 {} +

# Change all files to rw by everyone:

find . -type f -exec chmod 666 {} +

 

Share

Setup proxy on Ubuntu

proxyFor local website development it is usefull to add your domain-name to your local hosts file.

When doing this you have to be sure that this name does not get resolved by the default gateway. Execute the following steps to be able to navigate to test.yourdomain.tld in your browser:

1. Edit your /etc/hosts  file and add a line:

192.168.x.x test.yourdomain.tld

2. Start the gnome dconf-editor  tool and navigate to “System -> Proxy”. Add the domain test.yourdomain.tld to the list of ignore-hosts.

3. Logoff and logon again for this settings to take effect.

Check that your settings are updated with the following command in a terminal:

$:>env | grep proxy

The domain should show up at the no_proxy= entry.

If everything is ok you can navigate in your browser to test.yourdomain.tld.

Share

Create SVN repository on Synology

Howto install SVN on your Synology: http://forum.synology.com/wiki/index.php/Step-by-step_guide_to_installing_Subversion

Telnet to your NAS
Repositories has to be owned by svnowner; be sure to execute creation of the repository as svnowner (or chown afterwards):

$>su svnowner

On the synolyg your harddisk is mounten at /volume1; create a directory “svn” here:

cd /volume1
mkdir svn
cd svn

Now create your SVN repository with the svnadmin command (on the synology the svn command is not on the path but can be found at /opt/bin):

/opt/bin/svnadmin create test

If you want to delete a repository you can do this with regular unix commands; there is no “internal” SVN registration.

Now you have to setup the access to this new repository. Change directory to your new repository conf folder:
cd /volume1/svn/test/conf

The svnadmin command has stored some default files here; passwd and svnserve.conf. First edit the passwd file to add your users for this repository. Below the [users] text add your users.

Now edit the svnserve.conf in the same folder. Disable anonymous access to your repository by adding: anon-access = none

To use the password file for authentication of your users you have to uncomment the password-db = passwd line.

That’s all you have to do on your synology. SVN is setup (see link) and the repository is created with appropriate user access..

Now go to your client machine and checkout the new repository:

svn co svn://[your hostname here]/test

Check the status of your local repository copy:

svn status

Add a file to your repository

svn add newfile

And commit the file to the repository

svn commit newfile

 

 

 

 

Share

WordPress behind a proxy

To configure wordpress to use your proxy add the following settings to the wp-config.php file (add the appropriate values between the quotes):

define('WP_PROXY_HOST', '');
define('WP_PROXY_PORT', '');
define('WP_PROXY_USERNAME', '');
define('WP_PROXY_PASSWORD', '');
define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com');

 

Share

Create div with rounded borders and gradient

To create a HTML DIV with rounded borders and a gradient background use the folowing CSS style:

border: 1px solid #696;
color:white;
-webkit-border-radius: 8px;
-moz-border-radius: 8px;
border-radius: 8px;
-webkit-box-shadow: #666 0px 2px 3px;
-moz-box-shadow: #666 0px 2px 3px;
box-shadow: #666 0px 2px 3px;
background: #3388c9;
background: -webkit-gradient(linear, 0 0, 0 bottom, from(#3388c9), to(#256494));
background: -webkit-linear-gradient(#3388c9, #256494);
background: -moz-linear-gradient(#3388c9, #256494);
background: -ms-linear-gradient(#3388c9, #256494);
background: -o-linear-gradient(#3388c9, #256494);
background: linear-gradient(#3388c9, #256494);

On http://css3pie.com/ you can generate different CSS styles with this kind of “boxes”.

Share

WordPress Optimization

Edit your .htaccess file and add the line

Options All -Indexes

To optimize your WordPress installation add the following to your theme (not the WordPress) Functions.php at the very top:

remove_action( 'wp_head', 'wp_generator' ) ; 
remove_action( 'wp_head', 'wlwmanifest_link' ) ; 
remove_action( 'wp_head', 'rsd_link' ) ;
remove_action( 'wp_head', 'feed_links', 2 ); 
remove_action( 'wp_head', 'feed_links_extra', 3 );

Line 1 will remove the WordPress identifier

<meta name="generator" content="WordPress 3.5.1" />

Line 2 will remove the Windows Live Writer support for downloading css

<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://localhost/wp-includes/wlwmanifest.xml" />

Line 3 will remove

<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://localhost/xmlrpc.php?rsd" />

Line 4 and 5 will remove the secondary WordPress feeds

<link rel="alternate" type="application/rss+xml" title="bjdejong.NL &raquo; Feed" href="http://localhost/feed/" />
<link rel="alternate" type="application/rss+xml" title="bjdejong.NL &raquo; Comments Feed" href="http://localhost/comments/feed/" />

 

WordPress keeps track of your post revisions. To disable this feature place the following line in your wp-config.php

define( 'WP_POST_REVISIONS', false);

To keep at most three revisions use

define( 'WP_POST_REVISIONS', 3);

 

Share