Skip to content

Instantly share code, notes, and snippets.

find . -type f -size +512M -exec ls -lh {} \;
echo "FRASE" | tr 'A-Z' 'a-z'
sudo du -hsx * | sort -rh | head -10
@douglascabral
douglascabral / .htaccess
Last active May 28, 2020 21:54
Parâmetros de segurança para o Apache
#bloqueia o acesso ao git
RedirectMatch 404 /\\.git(/|$)
#bloqueia o acesso em arquivos e pastas ocultas
RedirectMatch 404 (?i)/\..+
#bloqueia o acesso ao node_modules e vendor
RedirectMatch 403 (?i)/View/node_modules
RedirectMatch 403 (?i)/vendor
mysqldump database_name_1 \
--host=address_1 \
--port=3306 \
--user=username_1 \
--password=password_1 \
--single-transaction \
--compress \
--no-create-db \
--skip-add-locks \
--skip-comments | mysql \
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password';
<VirtualHost *:80>
ServerName domain1.com
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/access.log combined
RedirectMatch ^/(.*)$ https://domain2.com/$1
</VirtualHost>
@douglascabral
douglascabral / center-text-in-image-with-php.php
Created March 9, 2018 13:43
Center text in image with PHP
<?php
// Variáveis de configuração
$width = 600;
$height = 180;
$fontsize = 17;
$angle = 0;
$font = './arial.ttf';
// Cria a imagem
@douglascabral
douglascabral / request_no_curl.php
Created February 5, 2018 19:13 — forked from iNaD/request_no_curl.php
Sending a GET/POST Request via PHP without CURL (fopen needs to be enabled)
<?php
$url = 'http://server.com/path';
$data = array('key1' => 'value1', 'key2' => 'value2');
// use key 'http' even if you send the request to https://...
$options = array(
'http' => array(
'header' => "Content-type: application/x-www-form-urlencoded\r\n",
'method' => 'POST',
'content' => http_build_query($data),
@douglascabral
douglascabral / gitalias.sh
Created September 15, 2017 19:21
GIT Alias
alias cmt='git add .; git commit -am'
alias cmtf='cmt "First commit"'
alias push='git push'
alias pull='git pull'
alias psh='git push origin'
alias pll='git pull origin'
alias ckout='git checkout'
alias st='git status'
alias mmd='git checkout master && git merge dev'
alias lg='git log'