Skip to content

Instantly share code, notes, and snippets.

SELECT
@rownum := @rownum + 1 AS rownumber
FROM
(SELECT @rownum := 0) AS tbl_rownumber
@douglascabral
douglascabral / proxy-apache-example.conf
Last active January 29, 2018 15:45
Example of Apache Proxy
<VirtualHost *:80>
ServerName nome-do-servidor.com.br
ServerAdmin webmaster@localhost
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyPass / http://127.0.0.1:8082/
ProxyPassReverse / http://127.0.0.1:8082/
DROP FUNCTION IF EXISTS `slug`;
DELIMITER //
CREATE FUNCTION `slug`(`str` TEXT)
RETURNS text
LANGUAGE SQL
DETERMINISTIC
NO SQL
SQL SECURITY INVOKER
COMMENT ''
@douglascabral
douglascabral / composer.json
Created August 19, 2016 14:35
Eloquent outside Laravel
{
"require": {
"illuminate/database": "*"
}
}
@douglascabral
douglascabral / mysql-import.sh
Created August 19, 2016 20:56
MySQL Import Data
mysql --host=<IP_HOST_HERE> \
--user=<USER> \
--password=<PASSWORD> \
<DATABASE> < /path/file/here.sql
@douglascabral
douglascabral / .bashrc
Created September 16, 2016 13:38
Extract command for bash
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract ."
else
if [ -f $1 ] ; then
# NAME=${1%.*}
# mkdir $NAME && cd $NAME
case $1 in
*.tar.bz2) tar xvjf ../$1 ;;
@douglascabral
douglascabral / iptables.txt
Created September 16, 2016 15:03
iptables example ping
Allow Ping from Outside to Inside
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT
Allow Ping from Inside to Outside
iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
iptables -A INPUT -p icmp --icmp-type echo-reply -j ACCEPT
@douglascabral
douglascabral / change-url-wp.sql
Created September 16, 2016 20:29
Change the URL WordPress
UPDATE wp_commentmeta SET meta_value = REPLACE(meta_value, 'http://site.com.br', 'http://localhost/');
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://site.com.br', 'http://localhost/');
UPDATE wp_posts SET guid = REPLACE(guid, 'http://site.com.br', 'http://localhost/');
Part 1
1. Read Text File
sed r text.txt
2. Find & Replace
sed ‘s/UNIX/MINIX/g’ text.txt
archlinux-keyring
archlinux-wallpaper
ark
atom
bluez
bluez-utils
darktable
dialog
dnsutils
docker