/images/avatar.webp

mrtn.me

Mirror a Git Repository Through Ssh

Redmine can show the timeline of a Git repository but this repository needs to be local (see here). When you host your repository externally (on GitHub, for instance), you need to synchronize your remote repository on your Redmine server.

The following shell script is an All in one command that can be easily put in the crontab to mirror the repository on your Redmine server :

#!/bin/sh


if [ "run" != "$1" ]; then
  exec ssh -i "$GIT_KEY" -o "StrictHostKeyChecking no" "$@"
fi

remote=$2
local=$3

echo "Mirroring from $remote to $local"

name=$(basename "$local")

export GIT_KEY="`mktemp /tmp/git.XXXXXX`"
export GIT_SSH="$0"

cat >"$GIT_KEY" <<EOF
-----BEGIN DSA PRIVATE KEY-----
### Put here your private key ###
-----END DSA PRIVATE KEY-----
EOF

if [ -d "$local" ]; then
        git "--git-dir=$local" remote update
else
        git clone --mirror "$remote" "$local"
fi

rm -f "$GIT_KEY"

exit 0

You need to copy the private key in the script (line 20). You can then use the script with the following syntax

Avoid Thread Issues While Testing an Android Service

The Android Test Framework provides many tools to test parts of an Android application, and the ServiceTestCase in particular to test your Service classes.

This class is quite useful but you may find yourself scratching your head because your test does not work like it should. This happens in particular if you’re doing some background work in your service, relying for example on AsyncTask for it.

Read on if you want to understand why it doesn’t work and find a solution for it.

Unlock and Root a Nexus Device

Having an unlocked and rooted device provides several advantages :

  • Easy backup and restore with Nandroid backup,
  • Easy firmware replacement and updates installation,
  • Advanced debugging capabilities.

The following instructions allow unlocking and rooting a Nexus device (Galaxy Nexus, Nexus 7) from the command line on a Linux machine. It involves:

  • Backuping your device,
  • Unlocking the bootloader,
  • Restoring the backup,
  • Rooting the device.

Prerequisites

Here is the list of prerequisites :

Quickly Deploy a Git Project on a Server With Ssh

So you have this brand new project my_project of yours with your local Git repository set up and you want to quickly make it available for others to clone on your repository server.

All your projects are located in your server git.mycompany.com under /srv/git. You’re using the user named git to connect to your server with the SSH private key located in ~/.ssh/git.

Here is the quickest way to deploy your project:

Installing Redmine on Centos 6 Dot 2 With Mysql and Apache

I needed recently to install the excellent project management tool Redmine on a CentOS 6.2 machine. There are some tutorials on the Web (here or here) but they are a little bit outdated. The following is a method that works as of today.

Pre-requisites

Logged as root, install the following packages:

yum install make gcc gcc-c++ zlib-devel ruby-devel rubygems ruby-libs apr-devel apr-util-devel httpd-devel mysql-devel mysql-server automake autoconf ImageMagick ImageMagick-devel curl-devel

And then install the bundle ruby gem:

Django on Windows: Run Celery as a Windows Service

In my previous post, I showed how to set up a Django project on a Windows Server to be served behind IIS. After setting up the server, the next thing we want with a Django application is to be able to run background and scheduled tasks, and Celery is the perfect tool for that.

On Windows, background processes are mostly run as Windows Services. Fortunately, Python for Windows Extensions (a.k.a pywin32) provides facilities to create a Windows Service.