Monthly Archives: January 2017

Script to clone all git repositories from all projects of a privately hosted Bitbucket server 1

The following script can download all git repositories from all of the projects that you have access to on a privately hosted Bitbucket server.

The execution work-flow of this script is as follows:

  1. It will ask for your username (the one you use to login on the Bitbucket server)
  2. Then it will ask for your password, the password will not be visible on screen as you type because we disabled the echo functionality for that step.
  3. Later, you will be prompted to provide the URL of the server, for this step be sure to define the protocol if it is http or https and the correct port number as well (e.g.
  4. Finally, you will be requested to give the location to where the repositories should be cloned to.
  5. Then the script will connect to the server, get the list of projects that you have access to and for each project retrieve the repositories of the project and clone them in the designated folder.
[Download not found]


echo -n "Username: ";
read username;
echo -n "Password: "; 
#Disabling echo, so that password will not be visible on screen
read -s password
#Enabling echo

echo -n "Server (e.g ";
read server;
echo -n "Location to clone repositories in: ";
read location;

mkdir -p "$location";
cd "$location";

#Getting all projects
curl --user "$username:$password" "$server/rest/api/1.0/projects/" | \
  grep -oP '"key":"\K\w+' | xargs -I {} -n 1 -I_project -- sh -c \
    "curl --user \"$username:$password\" \"$server/rest/api/1.0/projects/_project/repos\" | grep -o '\"ssh:[^ ,]\+' | xargs -L1 git clone";

exit 0;

[Download not found]


Notes for the future:

  • Separate the cloned repositories per project
  • Support for people that have hundreds of projects and/or hundreds of repositories using the paging functionality

asn1c: undefined reference to `SET_OF_encode_uper’

The following post is for the (repository:

When trying to link an ASN.1 structure that uses a SET OF, with support for Unaligned Packed Encoding Rules (UPER), we get the following error: undefined reference to 'SET_OF_encode_uper'.

Unfortunately, there is currently no solution for this problem, so we replaced the SET OF with a SEQUENCE OF.

The SEQUENCE OF type is the list (array) of simple or constructed types. The SET OF type models the bag of structures. It resembles the SEQUENCE OF type, but the order is not important: i.e. the elements may arrive in the order which is not necessarily the same as the in-memory order on the remote machines.

— From

Original (problematic) code

Elements ::= SEQUENCE
    property INTEGER,
    objects SET OF object

Updated (working) code

Elements ::= SEQUENCE
    property INTEGER,
    objects SEQUENCE OF object


Fedora 25: Connect to Windows Remote Desktop with RD Gateway Server

Since you are searching for this information, you may have found out that there is no way for Vinagre remote desktop viewer to connect to a Windows Server via Windows Remote Desktop (RDP) when a RD Gateway Server is needed for the configuration.

What we did to make this work was only to install remmina  on our machine using this command sudo dnf install -y remmina;.

Remmina by default supported the configuration using RD Gateway Server so we did not have to do nothing more than just use it.

Useful links:

asn1c: How do I know how big a buffer to allocate before using ‘uper_encode_to_new_buffer’?

The following post is for the (repository:

There is no need to compute the space needed.

If you pass the address to a pointer that is NULL pointer as the last parameter of uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) , then it will allocate by itself the required space.

void *buffer = NULL;
asn_per_constraints_s *constraints = NULL;
ssize_t ec = uper_encode_to_new_buffer(&asn_DEF_Image, constraints, image, &buffer);