- Stop mysql server
- Copy contents of datadir to another location on disk (~/mysqldata/*)
- Start mysql server again (downtime was 10-15 minutes)
- compress the data (tar -czvf mysqldata.tar.gz ~/mysqldata)
- copy the compressed file to new server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use it with `goto project` | |
goto () { | |
# cancel if no arguments | |
if [ -z "$1" ]; then | |
echo "Mau goto kemana??" | |
return 0 | |
fi | |
local UPPER=$(printf "%s" "$1" | tr '[:lower:]' '[:upper:]'); | |
local P_DIR="/Users/qutek/LocalServer/_$UPPER"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Auto login user without password, access with <code>http://domain.com/?force_login=username</code> | |
* [email protected] | |
*/ | |
if ( ! defined( 'WP_CLI' ) ) { | |
function force_login() { | |
if( !isset($_GET[ 'force_login' ]) || empty( $_GET[ 'force_login' ] ) ) | |
return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Debug Email | |
* Description: Simple script to change all email recipients for debugging / development purpose | |
* Version: 0.1 | |
* Author: Lafif Astahdziq | |
* Author URI: https://lafif.me | |
*/ | |
add_action( 'init', 'test_send_email' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Calculate stripe fee from amount | |
* so you can charge stripe fee to customers | |
* lafif <[email protected]> | |
*/ | |
var fees = { | |
USD: { Percent: 2.9, Fixed: 0.30 }, | |
GBP: { Percent: 2.4, Fixed: 0.20 }, | |
EUR: { Percent: 2.4, Fixed: 0.24 }, | |
CAD: { Percent: 2.9, Fixed: 0.30 }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Convert object to array | |
* @param [type] $obj [description] | |
* @return [type] [description] | |
*/ | |
function obj_to_array($obj) { | |
if(!is_array($obj) && !is_object($obj)) | |
return $obj; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Question #1 | |
* Scenario: | |
* 1. We have a list of companies in the Company custom post type. | |
* 2. Each Company has a ranking which is stored in post meta with a key called `ranking. The ranking is a decimal value between 0 and 100. A sample `ranking` is 94.9. | |
* 3. Each Company can also be marked as sponsored. If a Company is sponsored, a post meta with a key called `sponsored` is updated to 1. Otherwise, the `sponsored` meta value is `0` for each Company. | |
* | |
* Problem: | |
* Given the above scenario, provide the correct array of $args to pass into a new WP_Query instance so that we can return 100 companies with the "sponsored" companies first, and then after that sorted, from highest to lowest based off the `ranking` value. |
Since version 58, Chrome requires SSL certificates to use SAN (Subject Alternative Name) instead of the popular Common Name (CN), thus CN support has been removed.
To create SSL with SAN, use steps as follows
- Go to your target ssl directory (mine was
/usr/local/etc/httpd/ssl
) - Create
.conf
file - Generate SSL
- Point the cert on your apache conf