Docker links

Docker on Ubuntu 2

https://docs.docker.com/engine/installation/linux/ubuntulinux/#/install-the-latest-version

Windows

http://stackoverflow.com/questions/30496116/how-to-disable-hyper-v-in-command-line
http://serverfault.com/questions/767994/can-you-run-docker-natively-on-the-new-windows-10-ubuntu-bash-userspace
http://www.poweronplatforms.com/enable-disable-hyper-v-windows-10-8/

Docker articles

http://stackoverflow.com/questions/17236796/how-to-remove-old-docker-containers
https://techoverflow.net/blog/2013/10/22/docker-remove-all-images-and-containers/
http://severalnines.com/blog/mysql-docker-building-container-image
https://docs.docker.com/engine/tutorials/dockerimages/
http://blog.thoward37.me/articles/where-are-docker-images-stored/
Docker images
http://docker4wordpress.org/

WordPress upgrade

Error message:

wordpress update Could not create directory
This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php

Solution:

#set persmissions for writing to all
find -type d -print0 | xargs -0 chmod 777
find -type f -print0 | xargs -0 chmod 666

#revert back
find -type d -print0 | xargs -0 sudo chown deploy
find -type f -print0 | xargs -0 sudo chown deploy

find -type d -print0 | xargs -0 chmod 755
find -type f -print0 | xargs -0 chmod 664

#set permissions to correct user
sudo chown deploy ./wp-includes/js/tinymce/plugins/wpemoji/*

Additional links

How to update gcc to 4.8.1 on any ubuntu

Everything is perfectly explained in this post:

http://ubuntuhandbook.org/index.php/2013/08/install-gcc-4-8-via-ppa-in-ubuntu-12-04-13-04/

 
List of commands

sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update; sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --remove-all gcc 
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
gcc --version

 

Disable sudo password on Jenkins build machines

edit file sudoers

sudo nano /etc/sudoers

or

sudo visudo

and modify

%sudo ALL=(ALL) ALL

to

%sudo ALL=(ALL) NOPASSWD: ALL

and add following line to the end of the file:

user ALL=NOPASSWD: ALL

Be careful!

When editing sudoers, it’s necessary to be very careful. Any error cause that you will not be able to edit this file anymore and also not to use sudo ;-).

Here are links how to fix it (verified 😉 )

Remote links

Autossh forward ports to whole network

Use -g swith after -L section to forward ports to whole network

autossh -M 40008 -f -N user@server -L 33061:127.0.0.1:3306 -g -L 6380:127.0.0.1:6380 -o "ServerAliveInterval 60" -o "ServerAliveCountMax 3" -o BatchMode=yes -o StrictHostKeyChecking=no -i /root/.ssh/id_rsa

Other notes

Configuration file : /etc/init/autossh.conf

Start service:

sudo service autossh start

 

Other links

Using ssh as proxy/tunnel between Mac OS and Linux

How to connect to remote computer with private key by using ssh:

#register private key
ssh-add ~/dev/Private/ludek_vodicka_dsa.openssh

#connect to computer and forward local port to remote computer and remote port
ssh my-computer.com -p PORT -lUSER -L LOCAL_PORT:REMOTE_COMPUTER:REMOTE_PORT

#connect to computer and create SOCKS proxy on port SOCKS_PORT
ssh my-computer.com -p PORT -lUSER -D SOCKS_PORT

Note:

If your private key was created for Windows, it will probably not work on linux/mac. It’s necessary to convert it by using puttygen (on mac or windows). You need to open it by puttygen and choose “Save as openssh” from menu.

Additional resources

Customize OSX terminal prompt

How to customize default terminal prompt which looks like this?

ComputerName Directory UserName$

simply define PS1 variable with required format. To display only full path, use following:

export PS1="\w $"
  • \d – date
  • \t – time
  • \h – hostname
  • \# – command number
  • \u – username
  • \W – current directory (e.g.: Desktop)
  • \w – current directory path (e.g.: /Users/Admin/Desktop)

External links:

nginx and fast-cgi – tips and tricks

How to pass full path to fast-cgi app

It’s necessary to configure which parameters are passed to fast-cgi application from nginx server. For this purposes serves fastcgi_param keyword. It’s a good practice to keeps all fastcgi params together. For this purposes nginx has fastcgi.conf file. This file already contains most of useful fastcgi_param bindings.

fastcgi_param  QUERY_STRING       $query_string;
fastcgi_param  REQUEST_METHOD     $request_method;
fastcgi_param  CONTENT_TYPE       $content_type;
...

To include this file use include statement:

location / {
   include fastcgi_params;
   fastcgi_pass 127.0.0.1:9345;
 }

How to pass custom headers to fast-cgi app

Default configuration pass only default headers to fast-cgi. It’s necessary to add few more configurations statements:

fastcgi_pass_request_headers on;

After that headers are passed as HTTP_* parameters:

HTTP_HEADER1=2222

External links