Skip to content

Instantly share code, notes, and snippets.

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 / 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

Keybase proof

I hereby claim:

  • I am petrkohut on github.
  • I am petrkohut (https://keybase.io/petrkohut) on keybase.
  • I have a public key whose fingerprint is 44CE B549 9C7C D49F 5AFC 0562 7661 C898 200A C505

To claim this, I am signing this object:

@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 / test_tcp_udp.md
Last active March 24, 2017 16:00
Test TCP/UDP which port is open

TCP

sudo telnet 10.10.0.195 9300

UDP

sudo nmap -p 9300 -sU -P0 10.10.0.195

Open ports

@petrkohut
petrkohut / search-empty-string.md
Created April 10, 2017 07:56
Elasticsearch query - how to search empy string

How to search empty string in Elasticsearch

{
  "query": {
    "filtered": {
      "filter": {
        "not": {
          "filter": {
            "range": {
 "yourFieldName": {}
@petrkohut
petrkohut / how-to.md
Last active June 30, 2017 21:55
Debuging in Node.js

Debuging in Node.js

Install node-inspector

npm i -g node-inspector

Run node-inspector on a background

node-inspector &
@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_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