Skip to content

Instantly share code, notes, and snippets.

View allanfreitas's full-sized avatar
🏠
Working from home

Allan Freitas allanfreitas

🏠
Working from home
View GitHub Profile
@allanfreitas
allanfreitas / install_php71_centos.sh
Created September 24, 2017 12:49 — forked from jniltinho/install_php71_centos.sh
Install PHP 7.1 on CentOS 7.3
#!/bin/bash
### Install PHP 7.1 on CentOS 7.3 64Bits
### http://www.shaunfreeman.name/compiling-php-7-on-centos/
### https://www.howtoforge.com/tutorial/how-to-install-php-7-on-debian/
yum -y install git gcc gcc-c++ libxml2-devel pkgconfig openssl-devel bzip2-devel curl-devel libpng-devel libjpeg-devel
yum -y install libXpm-devel freetype-devel gmp-devel libmcrypt-devel mariadb-devel aspell-devel recode-devel libpqxx-devel
yum -y install autoconf bison re2c libicu-devel libwebp-devel wget unzip net-tools libc-client-devel libpng12-devel
yum -y install libxslt-devel

Install MariaDB 10.1.14 on CentOS 7

Create or edit:

$ sh vim /etc/yum.repos.d/MariaDB.repo

Copy and paste:

sed "s/,/\\`echo -e '\n\r'`/g"
@allanfreitas
allanfreitas / screen.sh
Created September 19, 2017 02:11 — forked from jrom/screen.sh
How to use screen
screen # Starts a screen session
<C-a d> # Detaches from the screen session
screen -r # Reattaches to a detached session
screen -S paco # Starts a screen session called "paco"
screen -r paco # Reattaches to a detached session called "paco"
@allanfreitas
allanfreitas / nginx.conf
Created September 19, 2017 02:10 — forked from joseluisq/nginx.conf
nginx hack for multiple conditions
if ($request_uri = /) {
set $test A;
}
if ($host ~* teambox.com) {
set $test "${test}B";
}
if ($http_cookie !~* "auth_token") {
set $test "${test}C";
@allanfreitas
allanfreitas / add_two_times.js
Created September 19, 2017 02:09 — forked from joseluisq/add_two_times.js
Sum two times values HH:mm:ss with javascript
/**
* Sum two times values HH:mm:ss with javascript
* Usage:
* > addTimes('04:20:10', '21:15:10');
* > "25:35:20"
*
* @param {string} start
* @param {string} end
* @returns {String}
*/
@allanfreitas
allanfreitas / bitbucket-deployment-script.sh
Created September 19, 2017 02:09 — forked from joseluisq/bitbucket-deployment-script.sh
Small Bitbucket shell script for deployment PHP composer project
#!/bin/sh
# Small Bitbucket shell script for deployment PHP composer project
# @author José Luis Quintana <http://git.io/joseluisq>
# Note: It's necessary to add some hook in repository settings.
# Settings
REPLOY_REPO_NAME=repository-name
DEPLOY_PATH=/username/www/project/
@allanfreitas
allanfreitas / numberformat.js
Created September 19, 2017 02:09 — forked from joseluisq/numberformat.js
number_format(number, decimals, decPoint, thousandsSep) in JavaScript, known from PHP. It formats a number to a string with grouped thousands, with custom seperator and custom decimal point
function number_format(number, decimals, decPoint, thousandsSep){
decimals = decimals || 0;
number = parseFloat(number);
if(!decPoint || !thousandsSep){
decPoint = '.';
thousandsSep = ',';
}
var roundedNumber = Math.round( Math.abs( number ) * ('1e' + decimals) ) + '';
@allanfreitas
allanfreitas / github_deploy.sh
Created September 19, 2017 02:08 — forked from joseluisq/github_deploy.sh
Tiny Github local deployment bash script
#!/bin/sh
# Tiny Github deployment bash script
# @author José Luis Quintana <quintana.io>
# @datetime 2016-10-22
# Settings
REPO_PATH=username/repo-name
DEPLOY_PATH=/deploy/path/on/my/server