Skip to content

Instantly share code, notes, and snippets.

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

.Eduan eduan

🏠
Working from home
View GitHub Profile
@eduan
eduan / duplicate_customer.sql
Created April 18, 2019 21:52
Duplicate Magento Customer (Basic Info / Address)
DROP PROCEDURE duplicate_customer;
DELIMITER $$
CREATE PROCEDURE duplicate_customer(IN old_entity_id INT, IN new_email VARCHAR(250))
BEGIN
DECLARE cursorlist_done BOOLEAN DEFAULT FALSE;
DECLARE old_address_entity_id INT;
DECLARE old_entity_type_id smallint(5);
DECLARE old_attribute_set_id smallint(5);
@eduan
eduan / ll
Created January 10, 2018 14:10
ls -la
@eduan
eduan / 0_reuse_code.js
Created August 22, 2017 13:33
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
#awesome command
( zcat $( ls -tr /var/log/apt/history.log*.gz ) ; cat /var/log/apt/history.log ) | egrep '^(Start-Date:|Commandline:)' | grep -v aptdaemon | egrep '^Commandline:'
@eduan
eduan / branchswithcer.sh
Last active May 11, 2016 14:38
Magento branch switcher
#/bin/bash
if [[ "$1" == "-h" || "$1" == "-help" ]]; then
echo "Script de deploy";
echo "./deploy [dir] [branch]";
exit;
fi
if [[ "$1" == "-b" ]]; then
echo "Branch atuais:";
for D in `ls -d $2*/`
$client = new SoapClient('http://www.dominio.com.br/api/v2_soap/?wsdl');
$session = $client->login('usuario', '123456789senha');
$result = $client->salesOrderInfo($session, '123132131');
var_dump($result);
@eduan
eduan / gist:ab145d4563f4f60ec726
Created January 11, 2016 16:40
top 10 arquivos/diretórios
du -a /var | sort -n -r | head -n 10
@eduan
eduan / gist:32dbe30d8174f4e2c5dc
Created January 4, 2016 17:00
verificando se processo já existe antes de executá-lo
if ((`pgrep pavucontrol` > 0)); then echo 'ja existe'; else pavucontrol; fi
@eduan
eduan / gist:bde28b986a4a8f50cd34
Last active August 29, 2015 14:22
install django
#Necessário ter python, apache e banco instalados
#Depois é preciso baixar pip
#Instalar o pip
wget https://bootstrap.pypa.io/get-pip.py
pyhton get-pip.py
sudo pip install Django
sudo pip install MySQL-python
sudo pip install django-input-mask
var MORSE_CODE = {'\.-' : 'A', '-\.\.\.' : 'B', '-\.-\.' : 'C', '-\.\.' : 'D', '\.' : 'E', '\.\.-\.' : 'F', '--\.' : 'G', '\.\.\.\.' : 'H', '\.\.' : 'I', '\.---' : 'J', '-\.-' : 'K', '\.-\.\.' : 'L', '--' : 'M', '-\.' : 'N', '---' : 'O', '\.--\.' : 'P', '--\.-' : 'Q', '\.-\.' : 'R', '\.\.\.' : 'S', '-' : 'T', '\.\.-' : 'U', '\.\.\.-' : 'V', '\.--' : 'W', '-\.\.-' : 'X', '-\.--' : 'Y', '--\.\.' : 'Z', '\.-\.-' : 'Ä', '\.--\.-' : 'Á', '\.--\.-' : 'Å', '\.\.-\.\.' : 'É', '--\.--' : 'Ñ', '---\.' : 'Ö', '\.\.--' : 'Ü', '-----' : '0', '\.----' : '1', '\.\.---' : '2', '\.\.\.--' : '3', '\.\.\.\.-' : '4', '\.\.\.\.\.' : '5', '-\.\.\.\.' : '6', '--\.\.\.' : '7', '---\.\.' : '8', '----\.' : '9', }
var decodeBits = function(bits){
var morse = [], bits = bits.split(''), last = '', trecho = '', frequency = {};
for (var i = bits.length - 1; i >= 0; i--) {
if(last.length > 0 && last != bits[i]){
var obj = frequency[last] ? frequency[last] : {};
obj[trecho.length] = trecho
frequency[last] = obj;