Skip to content

Instantly share code, notes, and snippets.

View ericrisler's full-sized avatar

Eric Risler ericrisler

  • London, Ontario
View GitHub Profile

Various methods to drop all tables in a database without droping the database. NOTE you should test these on your own, they are copied from https://stackoverflow.com/questions/3476765/mysql-drop-all-tables-ignoring-foreign-keys

Single line from terminal

echo "DATABASE_NAME"| xargs -i{} sh -c "mysql -h HOST -u USER -p -Nse 'show tables' {}| xargs -i[] mysql -h HOST -u USER -p -e 'SET FOREIGN_KEY_CHECKS=0; drop table []' {}"

Using script


DB_HOST=xxx
DB_USERNAME=xxx
@ericrisler
ericrisler / InstallHaProxy.sh
Last active March 27, 2017 16:59 — forked from jrouleau/InstallHaProxy.sh
Amazon Linux AMI Install HAProxy From Source (1.7.0 release pre configured). chmod +x InstallHaProxy.sh then ./InstallHaProxy.sh
#!/bin/bash
### VARIABLES ###
PRE_PACK="openssl-devel pcre-devel make gcc"
VER="1.7.0"
# Setup Colours
black='\E[30;40m'
red='\E[31;40m'
green='\E[32;40m'

Clear Magento 1 Data

SET FOREIGN_KEY_CHECKS=0;

-- Customers
TRUNCATE `customer_address_entity`;
TRUNCATE `customer_address_entity_datetime`;
TRUNCATE `customer_address_entity_decimal`;
TRUNCATE `customer_address_entity_int`;
@ericrisler
ericrisler / magento2_eav_attribute_reference.md
Last active March 18, 2021 13:15
References related to EAV Attribtues in Magento 2

The array of data you can pass to the \Magento\Eav\Setup\EavSetup::addAttribute() method is as follows:

Some of the attribute keys are remapped using the Magento\Eav\Model\Entity\Setup\PropertyMapper class. We indicate what it's mapped to in [] brackets

$data = [
     'type' => 'varchar',  
          // (string)[eav_attribute][backend_type]: database storage type (varchar|int|text|decimal)
     'backend' => NULL,      
          // (string)[eav_attribute][backend_model]: class name used to retrieve/save the attribute data to the db
     'frontend' => NULL,     
@ericrisler
ericrisler / most_common_openssl_commands.md
Created October 4, 2016 16:23
Most Common OpenSSL Commands

Credit: https://www.sslshopper.com/article-most-common-openssl-commands.html

SSL Tools: https://www.sslshopper.com/ssl-certificate-tools.html

The Most Common OpenSSL Commands

One of the most versatile SSL tools is OpenSSL which is an open source implementation of the SSL protocol. There are versions of OpenSSL for nearly every platform, including Windows, Linux, and Mac OS X. OpenSSL is commonly used to create the CSR and private key for many different platforms, including Apache. However, it also has hundreds of different functions that allow you to view the details of a CSR or certificate, compare an MD5 hash of the certificate and private key (to make sure they match), verify that a certificate is installed properly on any website, and convert the certificate to a different format. A compiled version of OpenSSL for Windows can be found here.

If you don't want to bother with OpenSSL, you can do many of the same things with our SSL Certificate Tools. Below, we have listed the most common OpenSSL command