Fork me on GitHub

super-easy Git remote repository

1. Creating a remote repository before the local one

Step 1: create the folder on the remote server and initialise the empty bare repository

ssh username@yourserver
mkdir yourgitremoterepo.git
cd yourgitremoterepo.git
git --bare init

Step 2: back to your machine, clone the repository

git clone username@yourserver:yourgitremoterepo.git

2. Making your existing local repository available on remote

Step 1: I assume that you have done something like this

cd yourlocalrepo
git init
git add .
git commit -a -m "first commit"

Step 2: to create the remote repository, login to your remote server and initialise an empty bare repository

ssh username@yourserver
mkdir yourgitremoterepo.git
cd yourgitremoterepo.git
git --bare init

Step 3: now back to your machine, link your remote repository with the local one and push all your files

git remote add origin username@yourserver:yourgitremoterepo.git
git push origin master

done!

sudo gem update –system under ubuntu/debian

If you have tried that command, you already know that doesn’t work!
Here is the correct procedure to update gem under ubuntu/debian without using apt-get/aptitude

$ sudo gem install rubygems-update
$ cd /var/lib/gems/1.8/bin
$ sudo ./update_rubygems
$ gem -v
$ 1.3.5

Happy rubying :)

the GIT cheatsheet

Finally the cheatsheet I was waiting for available here
;)

php 5.3, time and date functions and timezone

After installing PHP 5.3, you may get a warning for every function involving date and time like
Warning: strtotime() [function.strtotime]: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/London' for [...]
To fix this, you can set the timezone in your script using date_default_timezone_set(‘Europe/London’); or set it into the php.ini file with date.timezone = ‘Europe/London’

;)

MacPorts, PHP 5.3 and Mysqlnd

If you have recently upgraded to php 5.3 and you have done it using
sudo port install php5 +apache2+macosx+mysqlnd+pear
you should have noticed that you cannot use mysql anymore because of an error that, I’m sure, is driving you crazy
PHP Warning: mysqli::mysqli(): [2002] No such file or directory (trying to connect via unix:///tmp/mysql.sock) in /Users/antonio/Sites/db.php on line 25

PHP Warning: mysqli::mysqli(): (HY000/2002): No such file or directory in /Users/antonio/Sites/db.php on line 25
The problem comes from php and unfortunately is only fixable changing the location of the mysql.sock from the usual macports directory /opt/local/var/run/mysql5/mysqld.sock to /tmp/mysql.sock editing the file /opt/local/etc/my.cnf

;)

the twittersphere

Sooooooo funny!

svn revert cleanup

You have reverted an svn merge and you have a lot of files not tracked (with exclamation mark, basically)?
Clean it up:
svn status | awk '$1 == "?"  {print $2}' | xargs -t -i rm -r {}
Again, knowing awk and xargs turn helpful!

Tech Talk: Linus Torvalds on git

Git explained by his the creator. I’m more convinced than ever!

the correct procedure for compiling subversion 1.6.2

Not sure if this is the complete way of doing it (I’m not telling you which .deb to install), but it worked for me:

Remove some waste from eventual previous compilations:

$ rm -rf /usr/loca/lib/libsvn*
$ rm -rf /usr/local/lib/libapr*
$ rm -rf /usr/local/lib/libexpat*
$ rm -rf /usr/local/lib/libneon*

Run autogen

$ ./autogen.sh  

Configure and install (it is important to follow the order)

$ ./configure
$ make -j external-all
$ make -j local-all
$ sudo make install

That’s it. Hope to have helped someone as usual.

my .bashrc and env on mac

If someone find it useful… I do and this post is, honestly, for my record:


bash-3.2$ env
APSX2=/opt/local/apache2/bin/apxs
MANPATH=/opt/local/share/man:/opt/local/share/man:/opt/local/share/man:/opt/local/share/man:/usr/share/man:/usr/local/share/man:/usr/X11/man
TERM_PROGRAM=iTerm.app
LC_MONETARY=en_GB.UTF-8
SHELL=/bin/bash
TERM=xterm
LC_NUMERIC=en_GB.UTF-8
COMMAND_MODE=legacy
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/opt/local/apache2/bin:/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/opt/local/bin:/opt/local/sbin:/opt/local/apache2/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
LC_MESSAGES=en_GB.UTF-8
LC_COLLATE=en_GB.UTF-8
PWD=/Users/zekus
EDITOR=/usr/bin/mate -w
LANG=en_GB.UTF-8
HOME=/Users/zekus
SHLVL=1
LOGNAME=zekus
LC_CTYPE=en_GB.UTF-8
DISPLAY=:0.0
SECURITYSESSIONID=613f90
LC_TIME=en_GB.UTF-8
_=/usr/bin/env


bash-3.2$ cat ~/.bashrc
export PATH=/opt/local/apache2/bin:/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH
export DISPLAY=:0.0
export EDITOR='/usr/bin/mate -w'
export APSX2='/opt/local/apache2/bin/apxs'
alias mysqld='sudo /opt/local/share/mysql5/mysql/mysql.server'
alias apachectl='sudo /opt/local/apache2/bin/apachectl'
alias mysql='mysql5'
alias rake='/opt/local/bin/rake'
alias rails='/opt/local/bin/rails'
alias ruby='/opt/local/bin/ruby'
postgresqlctl () { sudo su postgres -c "/opt/local/lib/postgresql83/bin/pg_ctl $1 -D /opt/local/var/db/postgresql83/defaultdb"; }

Note the last row in the bashrc: is a function to load the postgres server on demand!