Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -e
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@everaldo
everaldo / unicorn-app.sh
Created March 21, 2014 14:29
Gist /etc/init.d script do Unicorn
################################################################################
# unicorn.sh
################################################################################
#!/usr/bin/env bash
set -e
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
AS_USER="USER_NAME"
@everaldo
everaldo / install_postgresql.sh
Created August 16, 2014 19:25
Install Postgresql
# Postgresql
# https://wiki.postgresql.org/wiki/Apt
#Quickstart
#Create /etc/apt/sources.list.d/pgdg.list. The distributions are called codename-pgdg. In the example, replace wheezy with the actual #distribution you are using:
deb http://apt.postgresql.org/pub/repos/apt/ wheezy-pgdg main
#(You may determine the codename of your distribution by running lsb_release -c.)
#Import the repository key from https://www.postgresql.org/media/keys/ACCC4CF8.asc, update the package lists, and start installing #packages:
@everaldo
everaldo / tmux.conf
Last active August 29, 2015 14:12
tmux.conf
set -s escape-time 1
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# splitting panes
# START:panesplit
bind | split-window -h
bind - split-window -v
# END:panesplit
# moving between panes
@everaldo
everaldo / page.html
Created May 8, 2015 19:26
Esqueleto HTML5
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title></title>
<link rel="stylesheet" type="text/css" media="screen" href="" />
<script type="text/javascript" src=""></script>
</head>
<body>
@everaldo
everaldo / referencias.txt
Created May 8, 2015 19:47
Referências PHP
Cookies:
http://php.net/manual/pt_BR/features.cookies.php
Session:
http://php.net/manual/pt_BR/book.session.php
Arrays:
@everaldo
everaldo / contador.php
Created May 9, 2015 00:02
contador, segunda versão
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Contador de Visitas</title>
</head>
<body>
<?php
1. Criar banco de dados <usuario>_access_log
2. Criar tabela dentro do banco de dados: log
3. Crie uma pasta no xampp
4. Crie um arquivo chamado access_log.php
5. Conectar ao banco de dados
6. Inserir registro do Log atual
7. Pesquisar todos os logs
8. Exibir todos os logs como uma tabela
@everaldo
everaldo / senhas_com_password_verify.php
Created May 28, 2015 19:39
Senhas com password verify (a partir do PHP 5.5.0 - 20 de Junho de 2013)
<?php
$senha = 'Of!cinaDePr0gramaçã0';
$hash = password_hash($senha, PASSWORD_DEFAULT);
$salt = substr($hash, 7, 22);
$verificacao = password_verify($senha, $hash) ? "Verdadeiro" : "Falso";
$teste_falso = password_verify("N@oEhaSenha", $hash) ? "Verdadeiro" : "Falso";
@everaldo
everaldo / encurta.php
Created May 29, 2015 22:38
Encurtador de URLs
<?php
/* Turma de Oficina de Programação - 18h15
29/05/2015
Encurtador de URLs
*/
$url = $_POST["url"];
function imprime_url(){