Skip to content

Instantly share code, notes, and snippets.

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

Jonatan Santos jonatanrdsantos

🏠
Working from home
View GitHub Profile
@jonatanrdsantos
jonatanrdsantos / 2019-https-localhost.md
Created July 16, 2020 02:36 — forked from cecilemuller/2019-https-localhost.md
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

#!/bin/bash
# Generate sample data and trigger Magento2 performance toolkit jMeter test plan.
HOST="magento2.loc"
BASE_PATH="/"
USERS=100
RAMP_PERIOD=300
LOOPS=1
ADMIN_USER="magento2"
ADMIN_PASSWORD="magento2"
<?php
/**
* A simple fix for a shell execution on preg_match('/[0-9]\.[0-9]+\.[0-9]+/', shell_exec('mysql -V'), $version);
* The only edit that was done is that shell_exec('mysql -V') was changed to mysql_get_server_info() because not all
* systems have shell access. XAMPP, WAMP, or any Windows system might not have this type of access. mysql_get_server_info()
* is easier to use because it pulls the MySQL version from phpinfo() and is compatible with all Operating Systems.
* @link http://www.magentocommerce.com/knowledge-base/entry/how-do-i-know-if-my-server-is-compatible-with-magento
* @author Magento Inc.
*/
@jonatanrdsantos
jonatanrdsantos / mage-database.sh
Created October 30, 2015 16:05 — forked from diogobaracho/mage-database.sh
Magento common queries: mysqldump , import database, change admin user password, change site url, change cookie domain
#!/bin/sh
echo "Generate dump?(yes)"
read godump
if [ $godump = 'yes' ] || [ $godump = 'y' ]; then
read -p "mysql user: " YOUR_USER
read -p "mysql password: " YOUR_PASSWORD
read -p "mysql host: " YOUR_HOST
@jonatanrdsantos
jonatanrdsantos / shopping_cart_sales_rule_with_coupon.php
Last active September 10, 2015 15:50 — forked from antoinekociuba/shopping_cart_sales_rule_with_coupon.php
Magento - Create shopping cart price rule with a specific coupon code programmatically.
<?php
/**
* Create Shopping Cart Sales Rule with Specific Coupon Code Programmatically
*/
// All customer group ids
$customerGroupIds = Mage::getModel('customer/group')->getCollection()->getAllIds();
// SalesRule Rule model
$rule = Mage::getModel('salesrule/rule');
#add 'node_modules' to .gitignore file
git rm -r --cached node_modules
git commit -m 'Remove the now ignored directory node_modules'
git push origin master
apt-get install php5-mcrypt
mv -i /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available/
php5enmod mcrypt
service apache2 restart
sudo apt-get install curl libcurl3 libcurl3-dev php5-curl
sudo service apache2 restart
@jonatanrdsantos
jonatanrdsantos / example.ex
Last active August 29, 2015 14:06 — forked from rin/example.ex
defmodule Example do
def main(args) do
args |> parse_args |> process
end
def parse_args(args) do
options = OptionParser.parse(args, switches: [help: :boolean],
aliases: [h: :help])
case options do
echo "* Updating system"
apt-get update
apt-get -y upgrade
echo "* Installing packages"
apt-get -y install build-essential libmagickcore-dev imagemagick libmagickwand-dev libxml2-dev libxslt1-dev git-core nginx redis-server curl nodejs htop
id -u deploy &> /dev/null
if [ $? -ne 0 ]
then