Skip to content

Instantly share code, notes, and snippets.

@rzani
rzani / handler.go
Created May 1, 2018
Print everything request's body
View handler.go
func Post(w http.ResponseWriter, r *http.Request) {
var results []string
body, err := ioutil.readall(r.body)
if err != nil {
http.error(w, "error reading request body",
http.statusinternalservererror)
}
results = append(results, string(body))
fmt.println(results)
}
@rzani
rzani / amazon-ec2-ftp.md
Created Apr 23, 2018 — forked from gunjanpatel/amazon-ec2-ftp.md
amazon ec2 LAMP and FTP installation and setup
View amazon-ec2-ftp.md
@rzani
rzani / ngx-tweaks.md
Last active Apr 7, 2017
Nginx tweaks
View ngx-tweaks.md

To fill worker_processes run:

# grep processor /proc/cpuinfo | wc -l

To fill worker_connections run:

# ulimit -n

View gist:0ae66a1715e8a6c2cbc4ba9281781968
Create a new machine - type: "Other", version: "Other/Unknown (64-bit)". I named mine RemixOS but it doesn't matter.
Allocate some RAM for it. I went with 2048MB and couldn't find the minimum required specs, but you should be okay with 2048+.
Create a virtual hard disk. I used the VDI file type with a fixed size of 8.00GB - simulating running it on a 8GB flash drive. The minimum specs require 8GB of space.
DON'T START THE MACHINE YET!
Click "Settings">"Storage">"Controller:IDE" and add an optical drive (icon looks like an optical disk with a plus symbol). Choose the OS's ISO. This should appear above any existing optical drives and below the hard drive.
Select the drive you just added and check the "Live CD/DVD" toggle. Then click "OK".
We are now ready to start the machine. When you do, there should be a splash screen - press the tab key before it tries to perform a default installation. If you missed it, just power down the machine (don't save its state or send the shutdown signal, just power it off) and tr
@rzani
rzani / readme.md
Created Feb 15, 2017
Change timezone docker containers
View readme.md

Dockerfile

RUN echo America/Sao_Paulo | sudo tee /etc/timezone && sudo dpkg-reconfigure --frontend noninteractive tzdata

Inside container

echo America/Sao_Paulo | tee /etc/timezone && sudo dpkg-reconfigure --frontend noninteractive tzdata
View Dockerfile
FROM php:5.6.22-fpm
# Installing Composer
RUN curl -sS https://getcomposer.org/installer | php && mv ./composer.phar /usr/local/bin/composer
RUN apt-get update && apt-get install -y \
zip \
unzip \
curl \
git-core \
@rzani
rzani / Dockerfile
Created Jan 25, 2017
Nginx + Pagespeed
View Dockerfile
FROM debian:jessie
MAINTAINER Rodrigo Zani <rodrigo.zhs@gmail.com>
ENV NGINX_VERSION 1.11.9
ENV NPS_VERSION 1.11.33.4
RUN apt-get update && \
apt-get install -y build-essential zlib1g-dev libpcre3 libpcre3-dev unzip make wget libssl-dev && \
rm -rf /var/lib/apt/lists/*
@rzani
rzani / README.md
Created Jun 28, 2016 — forked from chadrien/README.md
Debug PHP in Docker with PHPStorm and Xdebug
View README.md

Debug your PHP in Docker with Intellij/PHPStorm and Xdebug

  1. For your local dev, create a Dockerfile that is based on your production image and simply install xdebug into it. Exemple:
FROM php:5

RUN yes | pecl install xdebug \
    && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
@rzani
rzani / multiple_ssh_setting.md
Created Jun 23, 2016 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts
View multiple_ssh_setting.md

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
View How to change Pantheon Terminal's color scheme.md

How to change Pantheon Terminal's color scheme

Many of us spend many hours of our days using their terminal. Plus, we all have different tastes when it comes to color schemes. That's why the ability to change the color scheme of a terminal is one of its more important featuresl. Throughout this tutorial, I'll teach you how you can change the looks of your terminal, step by step.

This tutorial is aimed at elementary OS users, but it also works for any Ubuntu user. Start by installing dconf-tools:

sudo apt-get install dconf-tools

Secondly, you need to decide which theme you're going to apply. You can find dozens of terminal color schemes online, you can even design your own using this web application. Design the color scheme, hit "Get Scheme" and choose "Terminator". You'll get a raw text file with a background color, a foreground color and a palette. Those strings define your color scheme. In this tutorial, I'll post an