Sunday, 4 August 2013

How to Build CPUMINER from Source Code in Debian

cpuminer is a miner program for Litecoin and Bitcoin cryptocurrencies. It runs on CPUs (it does not need a graphic card to run).

By default it uses scrypt algorithm, but it can be configured to use SHA-256 one.

Build cpuminer from source code:

In order to build cpuminer from source code we will download its source code from its repository:
$ sudo aptitude install git
$ git clone
$ cd cpuminer
$ less README

Next we install some dependencies to be able to build it.
$ sudo aptitude install automake
$ sudo aptitude install pkg-config
$ sudo aptitude install gcc
$ sudo aptitude install make

NOTE: without this package: "possibly undefined macro: AC_MSG_ERROR" error appears
$ sudo aptitude install libcurl3-gnutls-dev

Create configure and Makefile files:
$ ./ installing './compile' installing './config.guess' installing './config.sub' installing './install-sh' installing './missing' warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS') installing './INSTALL' installing './depcomp'

Build the sources:

Sunday, 23 June 2013

How to Create a shared Git Repository in Debian (ssh, git-daemon, gitweb)

Git is a distributed revision control system.

We are going to create a remote shared git repository and add the following functionality to it:

- Read and write access using ssh protocol.
- Anonymous read only access via git-daemon.
- Browse every git repository via web.
- Send an email notification when user pushes a commit.

This article shows how to set a Git repository in a Debian distro (Sid).

Create the repository in the remote machine

First we are going to configure the remote machine where the git repository will be installed.

Create a directory where we will place every git repository:
$ mkdir /gitrepo

Install git
$ sudo aptitude install git

Every user able to read and write to the git repository must pertain to gitgroup group.
$ sudo groupadd gitgroup
$ sudo chgrp -R gitgroup /gitrepo
$ sudo chmod g+w /gitrepo

Generic home for users pertaining to gitgroup group:
$ sudo mkdir /home/gitgroup
$ sudo chgrp -R gitgroup /home/gitgroup

We add our current user to gitgroup group.
$ sudo adduser my_user gitgroup
Changes will become effective after login in again.
$ groups
my_user sudo gitgroup

We create now a bare git repository
$ cd /gitrepo
$ git init --bare --shared=0664 my_git_project
Initialized empty shared Git repository in /gitrepo/bar/

0664: other user has read only permissions.
0660: other user has no permissions.

$ chgrp -R gitgroup my_git_project

--shared option sets directories, new files etc to the right permissions.

Now we have a bare repository where we could upload our commits or another preexisting repository.

Read and write access

Sunday, 16 June 2013

How to call BTC-e API using LUA language is a web site where you can exchange virtual coins (like bitcoins, litecoins, etc), US dollars, euros and Russian rubles.

It provides a web interface for you to manually interact with.

Also if you are interested in building a bot to perform operations automatically, you could use their API.

In this article I am going to call the API from my Debian Sid system using Lua language.

Install Lua and dependencies

First I install lua 5.1 and luarocks to manage lua rocks.
$ sudo aptitude install lua5.1
$ sudo aptitude install luarocks

Once luarocks is already installed I install luasockets, and luasec. This will allow us to perform request using https protocol.
$ sudo luarocks install luasocket
$ sudo luarocks install luasec


Next we install sha2 rock to calculate hmac sha512 hashes.
$ sudo luarocks install sha2
$ cd /usr/local/lib/luarocks/rocks/sha2
$ sudo aptitude install lua-filesystem
$ sudo aptitude install lua5.1-md5-dev

Now we perform the tests:
$ lua test_sha2.lua
$ lua test_hmac.lua
They should pass OK.