Skip to content

Instantly share code, notes, and snippets.

Avatar

Reinaldo Barcelos Mendes reinaldomendes

  • Belo Horizonte MG
View GitHub Profile
View Update admin password
set @salt=substr(md5(concat('salt',CURRENT_TIME)),1,5)
set @pass='pass';
set @user="root";
update admin_user set `password`=CONCAT(SHA2(concat(@salt,@pass), 256),":",@salt,":1") WHERE `username`=@user
@reinaldomendes
reinaldomendes / .php_cs
Created Oct 30, 2016 — forked from jatubio/.php_cs
Config file to pass PHP-CS-Fixer with Laravel 5.1 custom and PSR-2 styles coding
View .php_cs
<?php
$finder = Symfony\Component\Finder\Finder::create()
->notPath('bootstrap/cache')
->notPath('storage')
->notPath('vendor')
->in(__DIR__)
->name('*.php')
->ignoreDotFiles(true)
->ignoreVCS(true);
View install kubernets docker
#
# Stop services on port 80 and 8080 before do that
#
export ARCH=amd64
export K8S_VERSION=$(curl -sS https://storage.googleapis.com/kubernetes-release/release/stable.txt)
docker run -d \
--volume=/:/rootfs:ro \
--volume=/sys:/sys:rw \
@reinaldomendes
reinaldomendes / local-register.php
Last active May 27, 2016
Magento 2 - auxiliares
View local-register.php
<?php
#permite o desenvolvimento de módulos sem que os mesmos tenham sido instalados via composer ainda.
$composerFiles = glob(__DIR__ . "*/*/*/composer.json");
$classLoader = null;
foreach ($composerFiles as $composerFile) {
$json = json_decode(file_get_contents($composerFile), true);
if (!isset($json['autoload'])) {
throw new Exception("Autoload not found on {$composerFile}");
@reinaldomendes
reinaldomendes / chroot.sh
Created Jan 29, 2016 — forked from dorneanu/chroot.sh
Put nginx and PHP to jail using Debian 8
View chroot.sh
#!/bin/bash
# Config
N2CHROOT=~victor/tmp/n2chroot
export JAIL=/var/www/chroot
function create_chroot {
# Create devices
mkdir $JAIL/dev
mknod -m 0666 $JAIL/dev/null c 1 3
View multiselectComponent.js
(function () {
var Multiselect = {
move: function (from, to) {
while (from.selectedIndex > -1) {
var option = from.options[from.selectedIndex];
to.appendChild(option);
}
},
moveAll: function (from, to) {
while (from.options.length > 0) {
View reset password
#first stop current mysql server
sudo service mysqld stop
#start mysqld_safe without grant and networking[security reason] in background
sudo mysqld_safe --skip-grant-tables --skip-networking &
#login as root
mysql -uroot
View usar bitbucket na locaweb
##################################
# ~/.ssh/config
##################################
Host bitbucket.org
Hostname altssh.bitbucket.org
Port 443
@reinaldomendes
reinaldomendes / curl.ini
Last active Dec 31, 2020
PHP Curl error 77 on ssl conections
View curl.ini
;###################################################
; NOTE
;####################################################
; change your curl.ini on /etc/php.d/curl.ini
;
;This config was only tested on amazon AMI
;Please check if /etc/ssl/certs/ca-bundle.crt exists
;
;If you don't have the ca-bundle root certificate you
; can get this in
View 01- Reset Password in database
/*Define variaveis
username: admin
password: YOUR_PASSWORD_HERE
*/
set @username='admin';
set @password='YOUR_PASSWORD_HERE';
set @salt='S4Lt';
update `admin_user` set password = concat(md5(concat(@salt,@password )),':',@salt)
where username=@username;