Miscellaneous

add line number in a file using vim

I just needed to insert line numbers in a file in vim. Thanks to https://vi.stackexchange.com/questions/8179/replace-a-pattern-with-current-line-number I now know how to do this by replacing the start of every line using the following command: :%s/^/\=printf("%4d: ", line('.')) which adds the current line number formatted to 4 characters with leading spaces.

setting up MacPorts apache2 with virtual hosts and PHP 5.6

I just needed an apache webserver with PHP 5.6 and some virtual hosts on my Mac running OSX El Capitan. The native OSX apache version comes with an older version of PHP which has no xdebug support, so I shut it down with sudo apachectl stop Installation I installed the following ports: sudo port install apache2 php56 php56-apache2handler php56-xdebug Apache configuration After installing the following commands are needed: cd /opt/local/apache2/modules sudo /opt/local/apache2/bin/apxs -a -e -n php5 mod_php56.

Apache VirtualHost on Mac OSX

note to self: to set up a virtual host named viho for local web development testing on OSX El Capitan (and probably earlier): define an alias name in /etc/hosts: 127.0.0.1 localhost viho ::1 localhost viho setup the virtual host configuration file /etc/apache2/other/viho.conf: <VirtualHost *:80> DocumentRoot "/path/to/where/the/files/are" ServerName viho </VirtualHost> browse to http://viho/ and enjoy.

Apache on Mac OSX El Capitan

Note to self: To start or stop the Apache webserver on Mac OSX El Capitan, use the terminal: sudo apachectl start sudo apachectl stop sudo apachectl restart The configuration is found in /etc/apache2/httpd.conf. The default DocumentRoot directory is /Library/WebServer/Documents. Additional configuration files should be put in /etc/apache2/other/*.conf files.

OpenShift configure which branch to deploy

Note to self: this is a copy from the OpenShift documentation: Configuring Which Branch to Deploy By default OpenShift deploys the master branch when you do a git push (when automatic deployments are enabled). You can change this behavior using the rhc app-configure –deployment-branch command, where is the new branch to deploy. $ rhc app-configure --deployment-branch # Master is the Default $ rhc app-configure myapp --deployment-branch new_branch Configuring application 'myapp' .