Skip to content

Instantly share code, notes, and snippets.

@petrkohut
petrkohut / index.js
Created March 18, 2016 12:21
coloring console.log in Node.js
// colored console.log
console.log('\x1b[36m', 'sometext' ,'\x1b[0m');
// other colors: https://telepathy.freedesktop.org/doc/telepathy-glib/telepathy-glib-debug-ansi.html
@petrkohut
petrkohut / howto.md
Last active October 20, 2021 08:57
How to have redis-cli and psql installed on machine using Docker

How to install redis-cli and psql client on your machine with Docker

Preparing docker images

We will use minimalistic Linux distribution called Alpine (5MB)

Dockerfile of redis-cli

FROM alpine:latest
RUN apk --update add redis
@petrkohut
petrkohut / docker-postgre.md
Last active June 30, 2017 21:59
Postgre server with Docker

Install PostgreSQL

docker pull postgres

Run PostgreSQL server

docker run --name postgres -p 5432:5432 -e POSTGRES_PASSWORD=my_pass -d -v $PWD:/var/lib/postgresql/data postgres
@petrkohut
petrkohut / setting_up_systemd.md
Last active March 16, 2017 09:16
How to setup Systemd (tested on Debian:jessie)

How to setup Systemd

Create our first autostarted daemon service

sudo vim /etc/systemd/system/ping.service

Edit this file like this:

[Service]
ExecStart=/bin/ping google.com
@petrkohut
petrkohut / setting_up_supervisor.md
Last active June 30, 2017 22:00
How to setup Supervisor

How to setup Supervisor

Installation

sudo apt-get install supervisor

Enable Supervisor web interface GUI

Add into file /etc/supervisor/supervisor.conf these lines:

@petrkohut
petrkohut / docker_tutorial.md
Last active July 5, 2017 22:13
First practical playing with Docker (made for internal company workshop about Docker)

First practical playing with Docker

Made for internal company workshop about Docker.

Installation

Linux

$ sudo wget -qO- https://get.docker.com/ | sh
$ sudo usermod -aG docker $USER
@petrkohut
petrkohut / start-zookeeper-docker.md
Last active July 16, 2021 14:23
Zookeeper + Node.js client examples

Zookeeper in Node.js

Install and run Zookeeper server

Download image

docker pull jplock/zookeeper

Run zookeeper container

sudo apt-get update
sudo apt-get install -y curl
curl -sL https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install -y nodejs
sudo apt-get install -qqy gcc make build-essential python
@petrkohut
petrkohut / rabbitmq_with_nodejs.md
Last active August 4, 2021 17:38
Example of reading from RabbitMQ in Node.js

RabbitMQ with Node.js

Install and run RabbitMQ server

Download image

docker pull rabbitmq:management

Run server with web management