Skip to content

Instantly share code, notes, and snippets.

@kakoma
kakoma / gist:0ff4a2d52998854ae00f8494206205cf
Last active September 30, 2016 01:48
Make KSD ticket public
add_action( 'ksd_after_ticket_info_metabox','after_ticket_info_metabox' );
function after_ticket_info_metabox( $post ){
ob_start(); ?>
<div style="" class="misc-pub-section misc-pub-public">
<span id="toggle-public">
<b>Make Public?</b>
<input type="hidden" name="_ksd_tkt_info_public" value="no" />
<input name="_ksd_tkt_info_public" type="checkbox" <?php checked ( get_post_meta( $post->ID, '_ksd_tkt_info_public', true ), "yes") ?> value="yes" />
</span>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
@kakoma
kakoma / Redirect ksd_customer role on login
Created March 7, 2017 07:53
For those who would like to redirect KSD customers to a special URL on login
<?php
//Based on https://codex.wordpress.org/Plugin_API/Filter_Reference/login_redirect
/**
* Redirect KSD customer after successful login.
*
* @param string $redirect_to URL to redirect to.
* @param string $request URL the user is coming from.
* @param object $user Logged user's data.
* @return string
@kakoma
kakoma / WordPressPlugin-Update posts in bulk
Last active June 27, 2017 06:24
WordPress Plugin to update WordPress posts in bulk, changing any post field, not just the ones WP admin allows. Customize the code inside the foreach loop as desired. Save this in a file, place it in your plugins directory and activate it. The changes will run on activation. Delete the plugin after the change. Article on this here: http://kakoma…
<?php
/**
* Plugin Name: Post Bulk Update
* Description: On activation, I'll updates certain fields of your posts at once. Can't wait!
* Version: 1.0.0
* Author: Your name here
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@kakoma
kakoma / mount_ebs.sh
Created December 1, 2017 01:53 — forked from stingh711/mount_ebs.sh
How to mount another EBS as /var on EC2 (ubuntu)
#!/bin/bash
#attach the EBS to /dev/sdf before running it
#format EBS
mkfs -t ext4 /dev/xvdf
#copy original /var to /dev/xvdf
mkdir /mnt/new
mount /dev/xvdf /mnt/new
cd /var
@kakoma
kakoma / reconfigure-virtualbox-dkms
Last active March 15, 2022 10:15
Reconfigure Ubuntu's virtualbox-DKMS after a kernel upgrade
#!/bin/bash
# Description: Everytime the Kernel is upgraded (which is quite often), virtualbox stops working and throws the following error:
#
# The provider 'virtualbox' that was requested to back the machine
# 'default' is reporting that it isn't usable on this system. The
# reason is shown below:
#
# VirtualBox is complaining that the installation is incomplete. Please
# run `VBoxManage --version` to see the error message which should contain
# instructions on how to fix this error.