Skip to content

Instantly share code, notes, and snippets.

View jaircuevajunior's full-sized avatar
:octocat:
Hello there!

Jair Cueva Júnior jaircuevajunior

:octocat:
Hello there!
View GitHub Profile
@jaircuevajunior
jaircuevajunior / jailkit.txt
Last active November 23, 2024 23:24
Jailkit Chroot SSH User Ubuntu
http://www.binarytides.com/setup-jailed-shell-jailkit-ubuntu/
PHP
vi /etc/jailkit/jk_init.ini
[php]
comment = the php interpreter and libraries
executables = /usr/bin/php5
directories = /usr/lib/php5, /usr/share/php, /usr/share/php5, /etc/php5, /usr/share/php-geshi, [B]/usr/share/zoneinfo[/B]
includesections = env
@jaircuevajunior
jaircuevajunior / mysql_debian_user.md
Last active October 21, 2024 18:42
Fix logrotate error regarding mysql on Ubuntu

Fix logrotate error regarding mysql on Ubuntu

Sometimes if you are mailed of cronjobs, will may got an error like this:

/etc/cron.daily/logrotate:
error: error running shared postrotate script for '/var/log/mysql.log /var/log/mysql/mysql.log /var/log/mysql/mysql-slow.log /var/log/mysql/error.log '
run-parts: /etc/cron.daily/logrotate exited with return code 1

Well, don't panic! Also don't ignore it! :)

@jaircuevajunior
jaircuevajunior / aws-ec2-setup-guide.md
Last active April 17, 2024 15:08
A simple guide to help myself setup a common LAmP environment on a AWS Ubuntu 18.04 instance with things that I should not forget

AWS EC2 Setup Guide

Enable Swap File (2GB)

fallocate -l 2G /swapfile &&\
chmod 600 /swapfile &&\
mkswap /swapfile &&\
swapon /swapfile &&\
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab &&\
free -h
@jaircuevajunior
jaircuevajunior / compile_mysql.md
Last active April 7, 2024 12:42
Compile MySQL 5.7 from source
  1. Download build-tools
apt-get install build-essential cmake -y
  1. Configure the compiler
cmake \
-DWITH_BOOST=/usr/local/src/mysql-5.7.19/boost/boost_1_59_0 \
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql57 \
@jaircuevajunior
jaircuevajunior / php5.6_plesk_obsidian_ubuntu18.04.md
Last active August 10, 2023 23:12
Instalando PHP 5.6 FPM no Plesk Obisidian utilizando Ubuntu 18.04

Instalando PHP 5.6 FPM no Plesk Obisidian utilizando Ubuntu 18.04

add-apt-repository ppa:ondrej/php &&\
apt-get update &&\
apt-get install php5.6-fpm php5.6-curl php5.6-gd php5.6-mbstring php5.6-mysql php5.6-xml php5.6-zip -y

mkdir -p /opt/plesk/php/5.6/{bin,etc,sbin} &&\
\
ln -s /etc/php/5.6/fpm/pool.d /opt/plesk/php/5.6/etc/php-fpm.d &&\
@jaircuevajunior
jaircuevajunior / shrink_xenserver_vm_disk.md
Last active January 22, 2023 10:20
Shrinking XenServer VDI VM Disk

Shrinking XenServer VDI VM Disk

XenServer doesn't allow us to do this kinda shrinking so we better recreate the vm copying all the files and recreating grub (boot) files.

1. Prepare the new disk

  • Create a Virtual Disk with the final desired size (eg our running vm disk has currently 100G and we want to shrinkg it to 80G so this new disk is gonna be 80G)
  • Attach the new disk to the running VM. (For this we'll need to shutdown the vm for a brief moment and power up it back again)
  • Under the VM terminal we format the new disk:
fdisk /dev/xvdb #(n, p, ...) DON'T FORGET TO CREATE THE SWAPP PARTITION!!!
mkfs.ext4 /dev/xvdb1

Alias para alguns comandos comuns no docker-compose

Aonde colocar esses códigos?

Se você possui MAC, provavelmente no arquivo ~/.zshrc.

Se você possui Linux, provavelmente ~/.bashrc.

Se você possui Windows, clique aqui

@jaircuevajunior
jaircuevajunior / docker-compose-v2.md
Last active June 25, 2021 19:57
Docker Compose V2 em Linux

Docker Compose V2

Este é um guia de como instalar o Docker Compose V2 em máquinas Linux para que possamos usufruir dos recursos desta versão que envolve melhorias de performance e uma mudança na forma de executar, em vez de ser docker-compose é docker compose ou seja, ele passa a ser um plugin dentro do comando docker.

O que é, etc.

O Docker Compose V2 será em breve o substituto do tradicional comando docker-compose (v1). Atualmente está em fase beta, mas já funciona muito bem e já vem por padrão no Docker Desktop for Mac e no Docker Desktop for Windows. Ou seja, ele não vem por padrão nas instalações de Linux (ainda) e a promessa é que ele venha na próxima major realease do Docker CE.

@jaircuevajunior
jaircuevajunior / dns.md
Last active May 4, 2020 18:13
Comando para pegar o nameserver (DNS) do domínio

Comando para pegar o nameserver (DNS) do domínio

Copie o script pra /usr/local/bin/dns ou ~/bin/dns e torne-o executável ex: chmod +x paht/to/dnsfile

#!/bin/bash

whois $1 |grep 'Name Server\|nserver'|cut -d':' -f2|sort|uniq|xargs|tr ' ' '\n'

Exemplo

@jaircuevajunior
jaircuevajunior / aws-codedeploy.md
Created April 27, 2020 15:13
Install AWS Code Deploy on Ubuntu 18.04
apt-get install -y ruby &&\
wget https://aws-codedeploy-us-east-1.s3.us-east-1.amazonaws.com/latest/install &&\
chmod +x ./install &&\
./install auto &&\
service codedeploy-agent start