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
| # apache | |
| Header set Referrer-Policy strict-origin-when-cross-origin | |
| Header set Content-Security-Policy 'report-uri /csp-report-parser;' | |
| Header set Feature-Policy "payment 'self'; sync-xhr 'self' https://iszuddinismail.com" | |
| Header set Permissions-Policy "payment=(self),sync-xhr=(self 'https://iszuddinismail.com')" | |
| # nginx | |
| # rc letak dalam etc/nginx-rc/extra.d/[APPNAME].headers.0.conf | |
| add_header Content-Security-Policy "report-uri /csp-report-parser"; | |
| add_header Referrer-Policy "strict-origin-when-cross-origin"; |
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 Version 5.4.30 | |
| -------------------------------------------------- | |
| Testing 10 item array over 1,000 iterations: | |
| serialize 2.1979808807373 ms | |
| json_encode 1.3420581817627 ms | |
| var_export 1.9409656524658 ms | |
| msgpack_pack 1.5850067138672 ms | |
| -------------------------------------------------- |
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
| # 19012018: awie | |
| # server ram 4GB, db setting for 2GB | |
| [mysqld] | |
| user=mysql | |
| datadir=/var/lib/mysql | |
| socket=/var/lib/mysql/mysql.sock | |
| local-infile=0 | |
| innodb_file_per_table=1 | |
| skip-networking | |
| skip-name-resolve |
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
| # analyze all dbs and tables everyday 3:30am | |
| 30 3 * * * root /usr/bin/mysqlcheck --all-in-1 -Aa --auto-repair --compress -uDBUSER -pDBPASS &>/dev/null | |
| # optimize all dbs and tables everyday 4:30am | |
| 30 4 * * * root /usr/bin/mysqlcheck --all-in-1 -Ao --auto-repair --compress -uDBUSER -pDBPASS &>/dev/null |
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
| ; Enable Zend OPcache extension module | |
| zend_extension=opcache | |
| ; Determines if Zend OPCache is enabled | |
| opcache.enable=1 | |
| ; Determines if Zend OPCache is enabled for the CLI version of PHP | |
| ;opcache.enable_cli=0 | |
| ; The OPcache shared memory storage size. |
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 | |
| // 29-Oct-2020 | |
| // Docket Cache Drop-In wrapper for DOCKET_CACHE_CONTENT_PATH constant | |
| if (!\defined('ABSPATH')) { | |
| return; | |
| } | |
| if (!\defined('DOCKET_CACHE_DROPINO_ALTERNATIVE') || !DOCKET_CACHE_DROPINO_ALTERNATIVE) { | |
| 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 | |
| /** | |
| * Docket Cache. | |
| * | |
| * @author Nawawi Jamili | |
| * @license MIT | |
| * | |
| * @see https://github.com/nawawi/docket-cache | |
| */ |
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 | |
| /** | |
| * Before sql query is generated, intercept `query_vars` and set `count_total` to false | |
| * to prevent `SQL_CALC_FOUND_ROWS` from being added to the sql query. | |
| * Also set our new `query_vars` attribute to true to track if count is required. | |
| */ | |
| add_action( 'pre_get_users', function($wpq) { | |
| if ( isset($wpq->query_vars['count_total'] ) && $wpq->query_vars['count_total'] ) { | |
| $wpq->query_vars['count_total'] = false; | |
| $wpq->query_vars['run_count'] = true; |
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: YOUR PLUGIN NAME | |
| */ | |
| include( dirname( __FILE__ ) . '/lib/requirements-check.php' ); | |
| $your_plugin_requirements_check = new YOUR_PREFIX_Requirements_Check( array( | |
| 'title' => 'YOUR PLUGIN NAME', | |
| 'php' => '5.4', |
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 | |
| // https://stackoverflow.com/a/41634468 | |
| $file = new SplFileObject("/path/to/file"); | |
| $file->seek(PHP_INT_MAX); // cheap trick to seek to EoF | |
| $total_lines = $file->key(); // last line number | |
| // output the last twenty lines | |
| $reader = new LimitIterator($file, $total_lines - 20); | |
| foreach ($reader as $line) { |