Menu Close

devstate.de

A Dreams Engine Blog. This Blog may not make any sense to you. This is a collection of internal snippets that we collect with our experiences, but we hope some of our post will help you in some way.

Simple ZSH Theme

# DESCRIPTION:
#   A simple zsh configuration that gives you 90% of the useful features that I use everyday.
#
# AUTHOR:
#   Geoffrey Grosenbach http://peepcode.com



# Colors
autoload -U colors
colors
setopt prompt_subst

# Prompt
local smiley="%(?,%{$fg[green]%}☺%{$reset_color%},%{$fg[red]%}☹%{$reset_color%})"

PROMPT='
%~
${smiley}  %{$reset_color%}'

Hombrew OSX

Before Everything:

brew update
brew upgrade

Fix Permissions

sudo chown -R $(whoami):admin /usr/local

Install Vim 8

brew install vim --override-system-vim

Install PHP7.1 (20.03.17)

brew tap homebrew/dupes
brew tap homebrew/versions
brew tap homebrew/homebrew-php
brew install php71

Install Latest Rsync

brew tap homebrew/dupes
brew install rsync
brew link rsync

Install Latest Tmux

brew install tmux

 

Fixing Ubuntu Random Issues

Fixing NO_PUBKEY:

W: GPG error: http://ppa.launchpad.net precise
Release: The following signatures couldn’t be verified because the public key is not available:
NO_PUBKEY 2EA8F35793D8809A

apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4F4EA0AAE5267A6C
or for EasyEngine:

apt-key adv --keyserver keyserver.ubuntu.com --recv 3050AC3CD2AE6F03

 

 

Fixing PIP / Letsencrypt Error:

OSError: Command /root/.local/share/letsencrypt/bin/python2.7 – setuptools pkg_resources pip wheel failed with error code 2

If you don’t have Python…Install it

Update:

sudo apt update && sudo apt-get -y upgrade

 

Install Python

sudo apt install python-pip

 

Fixit:

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"

 

more “fixes” to come

Useful commands for Docker

Enter Bash of your Docker

docker exec -it docker_wordpress_1 bash

Delete All Images & Containers

#!/bin/bash
# Delete all containers
docker rm $(docker ps -a -q)
# Delete all images
docker rmi $(docker images -q)

Docker+WP

Create a

docker-compose.yml

file in a any folder

i.e.

/Documents/Docker/mydomainsample.com/docker-compose.yml
docker-compose.yml
version: '2'

services:
 wordpress:
 depends_on:
 - mysql
 image: wordpress:php7.0
 ports:
 - "8080:80"
 volumes:
 - ./htdocs/assets:/var/www/html/wp-content
 links:
 - mysql
 environment:
 WORDPRESS_DB_HOST: mysql:3306
 WORDPRESS_DB_PASSWORD: wp

 mysql:
 image: mariadb:10.1.19
 ports:
 - "8081:3306"
 volumes:
 - ./databases:/var/lib/mysql
 environment:
 MYSQL_ROOT_PASSWORD: wp

Know Issues

WordPress Docker not starting or closing unexpectedly:

This happen because the MySQL docker database doesn’t have the necessary permissions:

Step 1: Access the docker cluster:

docker exec -it my_wordpress_mysql_docker_cluster bash

Step 2: Access MySQL:

msyql -uroot -pwp

Step 3: Allow MySQL WordPress User to access the databases:

GRANT ALL ON *.* to [email protected]'%' IDENTIFIED BY 'wp';

Create Databases

#Se crea la base de datos con el nombre

CREATE DATABASE name;

#Se crea el usuarios y contraseña dentro de MYSQL

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';

#Se proporciona al usuario el acceso a la información

GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';

Remove/Purge Easy Engine

Suggested by: http://www.galih.us/2014/12/cara-uninstall-easyengine.html

First:

ee system purge

changed to stack, so:

ee stack purge

Then:

rm -rf /etc/easyengine/;
rm -rf /etc/bash_completion.d/ee;
rm -rf /usr/local/sbin/ee;
rm -rf /usr/local/bin/ee;
rm -rf /usr/local/sbin/easyengine;
rm -rf /usr/share/easyengine;
rm -rf /var/www/*;
rm -rf /etc/nginx;
rm -rf /etc/php5;
rm -rf /etc/mysql;
rm -rf /var/lib/mysql;
rm -rf /etc/postfix;

And finally:

apt-get autoremove

Optimal Easy Engine

#Access Server

ssh [email protected]

#Update Server TimeZone

dpkg-reconfigure tzdata

#Secure SSH acccess with a different port

vim /etc/ssh/sshd_config

#Restart SSH 

service ssh restart

#Keep SSH Connection Alive 

ClientAliveInterval 30
ClientAliveCountMax 999999

#Add a Initial message 

vim /etc/motd
================= Project =========================================
https://project.io/
https://api.project.io/
https://cdn.project.io/
===================================================================

#Update/Upgrade Server

apt update; apt upgrade -y;

#Instalar Vim 8 Ubuntu/Mint

add-apt-repository ppa:jonathonf/vim
apt update
apt install vim

#Install Git

apt install git

#Beautyfy Terminal

  • follow this steps:
apt install zsh
  • Change permanently to zsh
chsh -s /bin/zsh 
  • Get .Antigen
git clone https://github.com/zsh-users/antigen.git .antigen
  • Edit .zshrc
vim ~/.zshrc
  • Copy the next Script:
# .zshrc Source Basic

source ${HOME}/.antigen/antigen.zsh

# Load the oh-my-zsh's library.
antigen use oh-my-zsh

# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle rsync
antigen bundle pip
antigen bundle python
antigen bundle history
antigen bundle command-not-found

# Third Party
antigen bundle kennethreitz/autoenv
antigen bundle zsh-users/zsh-completions

# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-completions src
antigen bundle zsh-users/zsh-syntax-highlighting

# Load the theme.
antigen theme https://github.com/denysdovhan/spaceship-zsh-theme spaceship

# Tell antigen that you're done.
antigen apply

source "${HOME}/.aliases"

# SET COMMON ALIASES

#Set Aliases

alias gonginx="/etc/nginx/"
alias gomysql="/etc/mysql/"
alias www="/var/www/"
alias zshrc="vim ~/.zshrc"
alias aliax="vim ~/.aliases"
alias vimx="vim ~/.vimrc"

# SET COMMON VIM CONFIGS

set mouse-=a
set paste

#Verificar el nombre

hostname

#Reiniciar server

reboot

#Intalas EasyEngine

wget -qO ee rt.cx/ee && sudo bash ee

#Creas el sitio y actualizas php a la version 7

ee site create misitio.com --wpfc --php7

#Para verificar que la configuración de nginx sea correcta

nginx -t

#Reiniciar el servicio nginx

service nginx restart

#Limpiar todo el EasyEngine

ee clean --all
Older Posts