niedziela, 24 kwietnia 2016

BIG DATA, lambda architecture - Only meat

"Big Data: Principles and best practices of scalable realtime data systems "

The condensed knowledge of BIG DATA and practices related to it. If I can understand it, anybody can ;)

sobota, 16 kwietnia 2016

Game development - child's dream?
Yeah, some inspiration gathered. I will share some post with my "private" legacy code.
I think everyone had some old stuff from early years, when programming was passion not a job :) . Let's try to get there one more time.

Interesting thing is that if anyone uses C++ Builder ( Now it's called embarcadero) or Delphi this days?

If You don't know the answers for this questions, You're definitely passionate:
Clean code?
Dress code?
Discussion with business?
Soft skills?

A 'one access request' too far :)
Corpo joke :)

sobota, 9 kwietnia 2016

How to implement simple shell, unix programming sandbox

Another snippet from Unix Sandbox. Do You want to write Your own shell? Maybe fork this code and improve it. Here is only basic concept. The main thing to improve is tokenizer for arguments. Adding history of commands is also a good idea.

What's done?
- CTRL+Z sigaction exit
- Main flow of fork and exec*
- Some hardcore tokenizer for 4 arguments (+ command)

But be aware, it's only for fun :)
666:>ls -l
-rw-r--r-- 1 root root 12315 lut 15 17:53 CMakeCache.txt
drwxr-xr-x 5 root root  4096 lut 15 18:10 CMakeFiles
-rw-r--r-- 1 root root  1433 lut 13 08:25 cmake_install.cmake
-rw-r--r-- 1 root root    80 lut 15 17:54 cmdhist
-rw-r--r-- 1 root root  5084 lut 15 17:53 Makefile
-rwxr-xr-x 1 root root 18194 lut 15 18:10 shell_terminal
-rw-r--r-- 1 root root  5458 lut 15 17:53 shell_terminal.cbp
sHELL unknown command
If You don't know how to start check it out:

piątek, 1 kwietnia 2016

A5/1 - stream cipher used to provide over-the-air communication privacy in the GSM

A5/1 stream cipher is used to ensure the privacy of communications in the standard GSM mobile phone . Specifications initially was kept secret but became public knowledge through leaks of information and the use of reverse engineering . Used in Europe and the United States.

Algorithm can be divided into several stages. Before the actual encryption need a proper initialization, filling the registers and calculating the TDMA frame (to provide time division multiple access), one which is required because the algorithm A5/1 is widely used in mobile telephony. Based on a number of TDMA base station determines the order data and the total initialization vector, which is what generated the seed of the frame number. On the basis of the generated vector registers are initialized to bits by some specific rules:

-Resetting all three shift registers.
-Random filling key and TDMA frame.
-Initiating registry key bits in 64 clock cycles without rules start / stop bit timing.
-Introduction to the registers bit TDMA frame in 22 cycles, also without the rule of bit timing.
-Followed by 100 cycles of mixing which take account of the principles behind the start / stop.

void a51_init() {
    int i = 0;
    for (i = 0; i < KEY_COUNT; i++) {
        reg1[0] = key[i] ^ reg1[0];
        reg2[0] = key[i] ^ reg2[0];
        reg3[0] = key[i] ^ reg3[0];


    for (i = 0; i < 100; i++) {

int a51() {
    int clock1 = reg1[8];
    int clock2 = reg2[10];
    int clock3 = reg3[10];

    int lf1 = reg1[18]; //Old bit value
    int lf2 = reg2[21]; //Old bit value
    int lf3 = reg3[22]; //Old bit value

    if (clock1 == clock2 || clock1 == clock3) {
    if (clock2 == clock1 || clock2 == clock3) {
    if (clock3 == clock2 || clock3 == clock1) {

    return lf1 ^ lf2 ^ lf3;
Full source code: