poniedziałek, 25 lipca 2016

New article - "Wizualizacja generatorów liczb pseudolosowych z Cloud9, Babylon.js i dat.GUI"

"Rozpoznać możliwości i potencjalne zastosowanie danej biblioteki czy programistycznego narzędzia można na wiele sposobów. W tym artykule postaramy się zgłębić funkcjonalności biblioteki Babylon.js i dat.GUI, tworząc prototyp aplikacji, która zwizualizuje nam w przestrzeni 3D dane pochodzące z generatorów liczb pseudolosowych."

  I would like to invite you to familiarize yourself with my second article that has been published:


niedziela, 26 czerwca 2016

If you don't understand some data, visualise them

Checkout my new pet app. PoC of visualisation of pseudorandom generators based on LFSR shift register algorithms.

-Visualisation of LFSR, Geffe, Shrinker, Stop and go and A5/1 algorithms
-3D or 2D space
-Manipulation of size and count of spheres
-Let you travel trough pseudorandom numbers world

RGV app
GitHub soruce

poniedziałek, 23 maja 2016

Atmosphere 2016 - after feelings

-Plus for flippers and old school console games.
-Minus too little meat and companies

Topic's which that I liked the best:

Microservices continuous delivery with MANTL & Shipped - HOT

Real user monitoring at scale - HOT

Metrics Driven-DevOps: Delivering High Quality Software like Facebook & Co - VERY HOT

Hadoop without CLI - HOT

sobota, 14 maja 2016

Atmosphere 2016


What to choose? :)

Day 1:

Microservices continuous delivery with MANTL & Shipped

Continuous IoT - with Docker, Go and Jenkins

ZMON: Zalando's OS approach to monitoring in the cloud and DCs

Running Cassandra on Amazon's ECS

Day 2:

DevOps Tactical Adoption Theory: Focus on Delivery Pipeline

Real user monitoring at scale

Continuous Deployment for Massive Scale Embedded Devices (IoT)

Metrics Driven-DevOps: Delivering High Quality Software like Facebook & Co

Web Application Security: from reactive to proactive

Hadoop without CLI

czwartek, 5 maja 2016

How to implement simple http echo server in C, posix sockets

Another snippet from Unix Sandbox.

Http echo server is a tool which echoes the data used in your request. Can be used for testing your clients, getting to know how HTTP works etc... only for fun, feel free to use it in any purpose.

Sample response:
GET / HTTP/1.1
Host: localhost
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8,pl;q=0.6

Full source code: https://github.com/khipis/c-unix-sandbox/blob/master/http-echo/http-echo.c

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: https://github.com/khipis/c-unix-sandbox/blob/master/shift-registers/a51.c

sobota, 19 marca 2016

Shrinker pseudo-random key generator

Shrinker generator based on LFSR implemented in other posts.

This generator is very fast. Generated bits seems to have a good cryptographic properties. String LFSR 1 is moved each time. The purpose of the function f is to shift register LFSR 2 in the case where one out of LFSR 1 or lower transfer operation, when the voltage on LFSR 1 is 0.
int shrinker() {
    int lf1 = lfsr_1();
    int lf2 = lfsr_2();

    while (lf1 != 1) {
        lf1 = lfsr_1();
        lf2 = lfsr_2();
    return lf2;
Source code: https://github.com/khipis/c-unix-sandbox/blob/master/shift-registers/stopngo.c

czwartek, 10 marca 2016

swagger-maven-plugin with Spring MVC annotations sample

I have found that adding swagger documentation for "legacy" spring application is not that easy :D

After a lot of research, I decided to use swagger-maven-plugin
but I had a problem, JSON is generated but without any API detected. Searching around the net I realized that im not the only one.

Finally I got the working example. Check this out: https://github.com/khipis/swagger-maven-example

sobota, 5 marca 2016

Stop and go

Stop and go generator based on LFSR implemented in other posts.

It has been proposed by CG Gunther in 1987. As the Geffe algorithm, was built with three LFSR's. It is based on the timing clock. LFSR 1 is moved at each clock cycle and controls the other two registers. If the output value will be 1 to 2 of the register LFSR is advanced in the register LFSR and the three preceding bit is repeated. However, if the output of LFSR 1 is 0, the LFSR 3 is moved and the previous bit in LFSR 2 is repeated. The output bits of the LFSR registers LFSR 2 and 3 are added modulo 2 to generate another pseudo-random bit sequence. If the length of all three registers are relatively prime , and periods of LFSR generators LFSR 2 and 3 have the greatest common divisor equal to 1 , the period of the generator is equal to the product of the periods of all registers.

So here's the code :)

int stop_and_go() {
    int lf2, lf3;
    if (lfsr_1() == 1) {
        lf2 = lfsr_2();
        lf3 = reg3[0];
    else {
        lf3 = lfsr_3();
        lf2 = reg2[0];
    return lf2 ^ lf3;
Source code: https://github.com/khipis/c-unix-sandbox/blob/master/shift-registers/stopngo.c

wtorek, 1 marca 2016

Geffe pseudo-random key generator

Geffe generator based on LFSR implemented in other posts.

The algorithm was designed in 1973 . By P.R. Geffe. It is based on interconnected nonlinear three registers LFSR. This generator is also cryptographically weak. It turns out that the sequence of the output is 75 % of the time equal to the output string LFSR 1 and 25 % of the time string to the output LFSR. Such a correlation is very dangerous and can easily be broken. Geffe generator can be expanded in such a way that in place of the generator LFSR 1 , LFSR 2 , LFSR 3 will be inserted three generators of Geffe. The resulting generator is characterized by a high modulus of complexity.

int geffe() {
    int lf1 = lfsr_1();
    int lf2 = lfsr_2();
    int lf3 = lfsr_3();
    int and1 = lf1 & lf2;
    int and2;
    if (lf2 == 1) and2 = 0 & lf3;
    else and2 = 1 & lf3;
    return and1 ^ and2;
Source code: https://github.com/khipis/c-unix-sandbox/blob/master/shift-registers/geffe.c

piątek, 26 lutego 2016

Linear feedback shift register

I want to introduce small pseudo random and cryptography series. It will includes lfsr shift registers and pseudorandom generators based on it. After all I will show implementation of A5/1 cipher used in GSM. Code of course is not optimised, but it's easy to understand how it works and that's the point.

Linear Feedback Shift Register (LFSR) . It is a shift register whose input bit is a linear function of its previous state . Typically, it is an essential component of a more complex algorithms. During one cycle of work algorithm calculated by bit XOR operations , it is sent to the first place on the left . The remaining bits are shifted to the right by one place. Bit which became the last position of the shift becomes another bit generated in the LFSR. If the algorithm is implemented in hardware , it generates bits very quickly. Its cryptographic properties but leave much to be desired . Cryptographic value is poor because the knowledge of 2n consecutive bits within allows to find the value generated from that point.

So here's the implementation:

bool stage[5] = {true, true, true};

int reg1[20] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int reg2[20] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int reg3[20] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};

int lfsr_1() {
    if (stage[0]) {
        stage[0] = false;
        return reg1[0];
    int n = 18, temp = reg1[6] ^reg1[17];   //1+x7+x18
    int k = 0;
    for (k = n - 1; k > 0; k--) reg1[k] = reg1[k - 1];
    reg1[0] = temp;
    return temp;

int lfsr_2() {
    if (stage[1]) {
        stage[1] = false;
        return reg2[0];
    int n = 19, temp = reg2[0] ^reg2[1] ^reg2[4] ^reg2[18]; //1+x+x2+x5+x19
    int k = 0;
    for (k = n - 1; k > 0; k--) reg2[k] = reg2[k - 1];
    reg2[0] = temp;
    return temp;

int lfsr_3() {
    if (stage[2]) {
        stage[2] = false;
        return reg3[0];
    int n = 20, temp = reg3[2] ^reg3[19];   //1+x3+x20
    int k = 0;
    for (k = n - 1; k > 0; k--) reg3[k] = reg3[k - 1];
    reg3[0] = temp;
    return temp;
This is the base for rest of generators Shrinker, Geffe and Stop n go:

niedziela, 21 lutego 2016

Premium sms Java integration

Last time I had to integrate application with sms premium payments.
I couldn't find any solution for easy set up and running, so I was forced to write my own client.

Here's the result, feel free to use this:

Library which integrates with premium-sms : https://platnosci-online.pl/panel.html
Sample usage:

Config config = ConfigBuilder.instance()
           .key("YOUR KEY")
           .partnerId("YOUR PARTNER ID")

CodeQuery codeQuery = CodeQueryBuilder.instance()
           .suffix("YOUR SUFFIX")
           .code("USER ENTERED CODE")

CodeVerifier verifier = new CodeVerifier(config);
            //Give profit's for user

That's all! :)

Go to: https://github.com/khipis/premiumsms

środa, 17 lutego 2016

Dining philosophers, counting semaphore solution, C POSIX THREADS Example

One of the solution in dining philosopher problem is to set up counting semaphore, which eliminates the phenomenon of deadlock, because only 4 philosophers at a time can compete for the chopsticks, so it will eliminate a situation that all philosophers will raise at once left chopstick.
sem_t sem;

void *philosopher_semaphore(void *p) {
    struct philosopher_t philosopher = *((struct philosopher_t *) (p));
    while (1) {
        sem_wait(&sem); // Semaphore up
        if (!pthread_mutex_lock(&chopstick[philosopher.left])) {
            printf("%d pick up's left chopstick \n", philosopher.nr);
            while (1) {
                if (!pthread_mutex_lock(&chopstick[philosopher.right])) {
                    printf("%d pick up's right chopstick, happy bastard, EAT \n", philosopher.nr);
        sem_post(&sem); //Semaphore down

int main() {

    sem_init(&sem, 0, 4); //Initialization of semaphore counting to 4
Now we have the real concurrency:
1 pick up's right chopstick, happy bastard, EAT 
1 pick up's left chopstick 
1 pick up's right chopstick, happy bastard, EAT 
1 pick up's left chopstick 
1 pick up's right chopstick, happy bastard, EAT 
2 pick up's left chopstick 
2 pick up's right chopstick, happy bastard, EAT 
3 pick up's left chopstick 
3 pick up's right chopstick, happy bastard, EAT 
2 pick up's left chopstick 
2 pick up's right chopstick, happy bastard, EAT 
0 pick up's left chopstick 
0 pick up's right chopstick, happy bastard, EAT 
Happy coding!
Full code here: https://github.com/khipis/c-unix-sandbox/blob/master/philosophers/philosophers_semaphore.c

wtorek, 16 lutego 2016

Dining philosophers, starvation example in C POSIX THREADS

In the last post I implemented dining philosophers problem with deadlock. Let's try to fix it by adding one asymmetric philosopher. This one picks up as first right chopstick instead of left.

The change is simple:
    p4_t->nr = 4;
    p4_t->left = 0;
    p4_t->right = 4;
Yeah finally we don't have deadlocks in our multithread enterprise software :)
But wait! One philosopher becomes fatter and fatter, when others are very slim...Im not good at jokes.

It's happening because of unfair access. No one picks up chopstick of the asymmetric philosoper in the first try. "Starvation is a problem encountered in concurrent computing where a process is perpetually denied necessary resources to process its work." - Wikipedia

Now we must face the starvation problem.

4 pick up's right chopstick, happy bastard, EAT 
4 pick up's left chopstick 
4 pick up's right chopstick, happy bastard, EAT 
4 pick up's left chopstick 
4 pick up's right chopstick, happy bastard, EAT 
4 pick up's left chopstick 
4 pick up's right chopstick, happy bastard, EAT 
4 pick up's left chopstick 
4 pick up's right chopstick, happy bastard, EAT 

The situation is better when we add more asymmetric philosophers:
    p0_t->nr = 0;
    p0_t->left = 1;
    p0_t->right = 0;

    p1_t->nr = 1;
    p1_t->left = 1;
    p1_t->right = 2;

    p2_t->nr = 2;
    p2_t->left = 3;
    p2_t->right = 2;

    p3_t->nr = 3;
    p3_t->left = 3;
    p3_t->right = 4;

    p4_t->nr = 4;
    p4_t->left = 4;
    p4_t->right = 0;
4 pick up's right chopstick, happy bastard, EAT 
1 pick up's right chopstick, happy bastard, EAT 
2 pick up's left chopstick 
2 pick up's right chopstick, happy bastard, EAT 
But the behavior is unpredictable.
Full code here: https://github.com/khipis/c-unix-sandbox/blob/master/philosophers/philosophers_starvation.c

piątek, 12 lutego 2016

Dining philosophers, deadlock example in C POSIX THREADS

I would like to introduce my series of C sandbox stuff. Only for fun, definitely no-production and not clean code :)

I tried to implement dining philosophers problem in perspective of black scenarios. First on the list is deadlock. According to wikipedia "...deadlock is a situation in which two or more competing actions are each waiting for the other to finish, and thus neither ever does."

So let's start, here's the sample philosopher code:
void *philosopher_deadlock(void *p) {
    struct philosopher_t philosopher = *((struct philosopher_t *) (p));
    while (1) {
        if (!pthread_mutex_lock(&chopstick[philosopher.left])) {
            printf("%d pick up's left chopstick \n", philosopher.nr);
            while (1) {
                if (!pthread_mutex_lock(&chopstick[philosopher.right])) {
                    printf("%d pick up's right chopstick, happy bastard, EAT \n", philosopher.nr);

After a seconds of execution we have a deadlock situation:
1 pick up's left chopstick 
1 pick up's right chopstick, happy bastard, EAT 
1 pick up's left chopstick 
1 pick up's right chopstick, happy bastard, EAT 
1 pick up's left chopstick 
2 pick up's left chopstick 
4 pick up's left chopstick 
3 pick up's left chopstick 
Full code here: https://github.com/khipis/c-unix-sandbox/blob/master/philosophers/philosophers_deadlock.c

niedziela, 7 lutego 2016

Scrolling textarea to selected text. Pure JavaScript

Really simple task but all solutions I found over internet have some disanvantages.
My also has one: inefficient. But works well in every case and it's written in pure JavaScript.

I stucked it together from all snippets I've seen.

If You know any better solution (without counting chars, pixel, sending keyups and others, not everytime working stuff, please leave comment with code snippet :)

function scrollToPosition(position, textarea) {
  var text = textarea.value;
  var textBeforePosition = text.substr(0, position);
  textarea.value = textBeforePosition;
  textarea.value = text;

poniedziałek, 1 lutego 2016

CQ5, AEM6 real price

When I was reading
Why are Mid-Market Companies Still Looking at Adobe Experience Manager?

I have only one tought. Is $450,000 - $2 000 000 the final price?

I think the price is much bigger. You have to think about the specialists who are expensive and hard to find with boxed solutions. Usually you must train some but not all employers think about it cause mostly they think "I pay so much for a system so propably it's safe, efficient etc.". And definitely its self configurable and easy to maintain :)

In my opinion it costs much more.



Wtf? Servers configuration issues? You can say it's only a login page...


AEM6 security checklist
CQ5 security checklist

Now imagine opposite situation, when attacker will go trough "security checklist" :)

Results are terrible. $450,000 it's just small change.

środa, 27 stycznia 2016


I faced the problem with npm manager.

Fameous ENOENT problem:
'Error: ENOENT, stat 'C:\Users\username\AppData\Local\npm',

A lot of accepted solutions around the net say that you should try to manually create the npm folder. And It works. But my problem was a little bit different. I was forced to set up external folder for node_modules. I set up it wrong ( :D ) with some '' around the path and this was a mistake cause whole npm was broken.

To fix it I was searching for a file with this configuration and finally I succeed:

If You set it globally or in root of npm installation

Hope It will save some time for somebody...

sobota, 23 stycznia 2016

REST - Only meat

If I would have to choose the book whith the smallest number of pages, which transmits a lot of knowledge it would be this one:

"RESTful Java Patterns and Best Practices"

The condensed knowledge of REST and practices related to it. Without waffling. The very essence - :) it gets to me. Negligible number of pages allows for fairly quick refreshing information if needed.

czwartek, 21 stycznia 2016

Blog turns into English

Yes, that's correct. Short post, big change :)

DevOps, Microservices, R&D

In the present company we must face the problem of transfer monolithic architecture to microservices. Subject is hot and arousing much controversy. Everything is blocked on the discussion where we cannot specify any other decision than the usual statements like "something must be done". In my opinion it's better to make a small step, than just talking about the big one. With inspirations from the conference ( Robert Firek presentation ) I decided to put a few links that can be used to conduct the first R & D. There are lot of solutions :

-Terraform https://www.terraform.io/
-Amazon Webservices https://aws.amazon.com/
-Ansible http://www.ansible.com/
-Spring cloud netflix http://cloud.spring.io/spring-cloud-netflix/

-Docker https://www.docker.com/
-Kubernetes http://kubernetes.io/
-Nomad https://www.hashicorp.com/blog/nomad.html
-Mesosphere https://mesosphere.com/
-Mesos http://mesos.apache.org/

Service discovery:
-ZooKeeper https://zookeeper.apache.org/
-Eureka https://github.com/Netflix/eureka
-Consul https://www.consul.io/
-NGinx https://www.nginx.com/

-AppDynamics https://www.appdynamics.com/
-Splunk http://www.splunk.com/
-Loggly https://www.loggly.com/
-Datadog https://www.datadoghq.com/lpg/
-Nagios https://www.nagios.org/about/overview/
-Logstash https://www.elastic.co/products/logstash
-Fluentd http://www.fluentd.org/
-Pingdom https://www.pingdom.com/

niedziela, 17 stycznia 2016

Boiling frogs, after feelings

It was pretty good so I will present only minor flaws:

-Too little stands employers
-Too little creative competitions ( I was able to take first and second place in one of them )

A selection of agenda presented in the previous post proved to be successful.

Especially presentation by Michał Płachta was very interesting

I collected a lot of ideas , so it is possible that there will be a lot of content here for a little more merits.

środa, 13 stycznia 2016

BolingFrogs on Saturday


One of the events worth seeing!

I choosed:

Developerze, zdevelopuj się sam!

Przybornik Devopsa, czyli krótki przewodnik po mikroserwisach
( Microservices hot! topic :) )

Raj dla poliglotów: Wszystko płynie
I remember author from http://2015.33degree.org/, great presentation of Akka in Scala

Effective Software Delivery
Jakub Kubrynski - good author from 33degree

HATEOAS as if you meant it
I like REST :)

Machine Learning dla Developerów
Description convinced me

16 Stycznia 2016
Hotel Ibis Styles
pl. Konstytucji 3 Maja 3
50 083 – Wroclaw

niedziela, 10 stycznia 2016

Generowanie aplikacji - JHipster

"Jakie cechy powinna posiadać aplikacja webowa, aby sprostać wymaganiom użytkowników? Te najważniejsze to: responsywność, dopasowanie do ekranów różnych urządzeń, obsługa wielu języków, integracja z portalami społecznościowymi, możliwość rejestracji użytkowników oraz łatwego monitorowania jej stanu. A teraz wyobraź sobie, że to i wiele więcej możesz otrzymać w czasie krótszym niż przeczytanie tego artykułu."

  I would like to invite you to familiarize yourself with my first article that has been published:


czwartek, 7 stycznia 2016

Pierwszy post, pierwsze dylematy.

Chyba najlepiej będzie na początku nadmienić jakie tematy chcialbym tu poruszac.

Z założenia ma byc miks programowania oraz prowadzenia kariery z tym związanej w połączeniu ze sportem :)

Zamierzam tez wrzucać tu krótkie recenzje ksiażek które własnie czytam, jedna z nich:


"Sprawny programisa. Pracuj, zarabiaj i zdobywaj kwalifikacje" autorstwa Johna Sonmeza.

Czy polecam? Ciezko powiedziec, uwazam ze jak dla mnie juz na nia za pozno, do wielu wskazowek doszedlem we wlasnym zakresie. Mysle ze duzo wiecej bym z niej wyniosl czytajac ja na samym poczatku swojej drogi. Natomiast ksiazka na pewno wywarla jakies oddzialywanie na mnie -> uwidacznia sie to chociazby poprzez probe uruchomienia tego bloga :D. Jezeli nie masz pojecia jak powinienes kierowac swoja kariera developerska to warto zerknac.