Skip to content

Instantly share code, notes, and snippets.

View matthijs166's full-sized avatar

Matthijs Knigge matthijs166

View GitHub Profile
@matthijs166
matthijs166 / isp_corn
Created July 19, 2018 16:10
run cronjob ispconfig php
php /usr/local/ispconfig/server/cron_debug.php --cronjob=500-backup.inc.php
100-mailbox_stats.inc.php 100-monitor_mail_queue.inc.php 150-webalizer.inc.php
100-monitor_clamav_log.inc.php 100-monitor_mem_usage.inc.php 200-ftplogfiles.inc.php
100-monitor_cpu.inc.php 100-monitor_mongodb.inc.php~ 200-logfiles.inc.php
100-monitor_database_size.inc.php 100-monitor_openvz.inc.php 300-quota_notify.inc.php
100-monitor_disk_usage.inc.php 100-monitor_os_version.inc.php 400-openvz.inc.php
100-monitor_email_quota.inc.php 100-monitor_raid.inc.php 500-backup.inc.php
100-monitor_fail2ban.inc.php 100-monitor_rkhunter.inc.php 500-backup_mail.inc.php
@matthijs166
matthijs166 / webdav_mnt
Created July 19, 2018 15:08
add webdav mount to ubunut in mnt
To make it work you only need to know if the connection is secure (davs) or not (webdav) and if the package davfs2 is installed (open a terminal and type “sudo apt-get install davfs2”).
However in some cases you may want to have this share always mounted in your system and without the need to put credentials. If this is your case, the solution is pretty easy:
Create a folder on your disk into which the web share will be mounted:
sudo mkdir /mnt/sharename
sudo nano /etc/davfs2/secrets
add the line:
@matthijs166
matthijs166 / error log
Created July 16, 2018 16:01
Enable php error logging in htaccess display error
php_flag display_startup_errors on
php_flag display_errors on
php_flag html_errors on
php_flag log_errors on
@matthijs166
matthijs166 / sudo add-apt-repository error fix
Created May 8, 2018 14:04
sudo add-apt-repository ppa:package
# apt-get install --reinstall ca-certificates
# update-ca-certificates
@matthijs166
matthijs166 / Escape make safe
Created February 9, 2018 18:35
Escape a string make it save for saving
function MakeSafe($unsafestring)
{
$unsafestring= htmlentities($unsafestring, ENT_QUOTES);
if (get_magic_quotes_gpc())
{
$unsafestring= stripslashes($unsafestring);
}
$unsafestring= mysql_real_escape_string(trim($unsafestring));
@matthijs166
matthijs166 / remove-default-image-sizes.php
Last active February 8, 2018 23:38 — forked from douglasanro/remove-default-image-sizes.php
Remove default WordPress image sizes
<?php
/* ----------------------------------------------------------------------------
* Remove default image sizes
* ------------------------------------------------------------------------- */
//Remove default image sizes
add_action('init', 'remove_plugin_image_sizes');
function remove_plugin_image_sizes() {
remove_image_size('shop_thumbnail');
remove_image_size('shop_catalog');
@matthijs166
matthijs166 / get product type
Created February 3, 2018 23:17
Get the product type of a product
global $product;
// $product->is_type( $type ) checks the product type, string/array $type ( 'simple', 'grouped', 'variable', 'external' ), returns boolean
if ( $product->is_type( 'variable' ) ) {}
@matthijs166
matthijs166 / get plugin dir
Created February 1, 2018 12:17
get plugin root dir folder url base
WP_PLUGIN_DIR // full path, no trailing slash
WP_PLUGIN_URL // full url, no trailing slash
@matthijs166
matthijs166 / get id archive
Created January 13, 2018 16:44
Get the post id from a archive page wordpress
$page_id = get_queried_object_id();
echo $page_id;
@matthijs166
matthijs166 / indentation setting
Created January 8, 2018 22:12
set padding for indentation indent incrace or decrace
//indentation filter spring in text tyinimce
function modify_tinymce_settings($settings) {
$settings['indentation'] = '10px';
return $settings;
}
add_filter('tiny_mce_before_init', 'modify_tinymce_settings');