Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lucasff
lucasff / gist:3618d7f5c54b5d3b5482
Created August 3, 2014 17:10
Dork for ThemeForest
intitle:"Index of" "themeforest-2833226-avada-responsive-multipurpose-theme.zip"
@lucasff
lucasff / simple.dns
Last active August 29, 2015 14:04
cPanel custom defaults
; cPanel %cpversion%
; Zone file for %domain%
$TTL %ttl%
@ %nsttl% IN SOA %nameserver%. %rpemail%. (
%serial% ; serial, todays date+todays
3600 ; refresh, seconds
600 ; retry, seconds
1209600 ; expire, seconds
3600 ; minimum, seconds
)
@lucasff
lucasff / default.html
Last active August 29, 2015 14:04
cPanel defaults
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Default Web Site Page</title>
<style type="text/css">
body {font-family:arial;margin:0;padding:0;background:url(/img-sys/bg.jpg) repeat-x #dff4fe;color:#6f6f6f;font-size:12px;}
a {color:#0075a9;}
* {margin:0;padding:0;}
h1 {background:url(/img-sys/header.jpg) no-repeat; height:83px;text-indent:-9999px;}
@lucasff
lucasff / setlocale.php
Created July 29, 2014 19:34
Force pt_BR locale in PHP
<?php
date_default_timezone_set('America/Sao_Paulo');
setlocale(LC_ALL, 'pt_BR.utf-8', 'ptb', 'pt_BR', 'portuguese-brazil', 'portuguese-brazilian', 'bra', 'brazil', 'br');
setlocale(LC_TIME, 'pt_BR.utf-8', 'ptb', 'pt_BR', 'portuguese-brazil', 'portuguese-brazilian', 'bra', 'brazil', 'br');
@lucasff
lucasff / migrateEmailWithImapSync.sh
Last active October 5, 2017 11:33
imapSync collection
#!/bin/bash
LOGFILE=imapsync.log
FOLDERS=( 'Folder1' 'Folder2' 'Folder3' 'Folder4' '...' 'FolderN' 'INBOX' 'All Mail' 'Bin' 'Drafts' 'Starred' 'Sent Mail' )
TIMES=( '--minage 1090' '--maxage 1091 --minage 999' '--maxage 1000 --minage 908' '--maxage 909 --minage 817' '--maxage 818 --minage 726' '--maxage 727 --minage 635' '--maxage 636 --minage 544' '--maxage 545 --minage 453' '--maxage 454 --minage 362' '--maxage 363 --minage 271' '--maxage 272 --minage 180' '--maxage 181 --minage 89' '--maxage 90' )
SRC_EMAIL=''
DST_EMAIL=''
@lucasff
lucasff / cpanel-amazon-2.sh
Created July 29, 2014 19:20
cPanel on Amazon IP Update
for i in `cat /etc/trueuserdomains | cut -d: -f1`
do
/usr/local/cpanel/bin/swapip OLDIP NEWIP $i;
done;
@lucasff
lucasff / change_charset.php
Created July 29, 2014 19:18
Change charset of MySQL
<?php
function MysqlError()
{
if (mysql_errno())
{
echo "<b>Mysql Error: " . mysql_error() . "</b>\n";
}
}
@lucasff
lucasff / add_prefix_sql.sh
Last active August 29, 2015 14:04
Add a prefix on tables of a SQL dump
#!/bin/sh
#
# Simple script for setting table prefixes in SQL-dump
if [ $# != 2 ]; then
cat >&2 << EOH
This is Drupal database prefixer.
Usage:
$0 prefix original_db.sql > prefixed_db.sql
- all tables will be prefixed with 'prefix'
EOH
@lucasff
lucasff / strip_1st_char_wp.sql
Created July 29, 2014 19:13
Strip out first character
UPDATE wp_posts SET post_content = TRIM(LEADING '>' FROM post_content);
@lucasff
lucasff / helpers.sh
Created July 29, 2014 19:12
Shell common commands
# Salvar galeria sem as fotos (somente o código-fonte)
# Remove "empty" files
for i in `find /home/*/public_html/* -type f -name 'empty'`; do rm -f $i; done
# Remove error_logs
for i in `find /home/*/public_html/* -type f -name 'error_log'`; do rm -f $i; done
# Permissions fix
find . -type f -exec chmod 644 {} \;