Skip to content

Instantly share code, notes, and snippets.

ship it

Kailey Lampert trepmal

ship it
Block or report user

Report or block trepmal

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
# Find your files in /tmp older than 7 days
find /tmp -mtime +7 -user `whoami` -exec ls -lpdh {} \; | column -t
# Delete your files in /tmp older than 7 days
find /tmp -type f -mtime +7 -user `whoami` -delete
find /tmp -type d -mtime +7 -user `whoami` -empty -delete
# Find your files in /home (2 dirs deep) older than 7 days
find /home -maxdepth 2 -mtime +7 -user `whoami` -exec ls -lpdh {} \; | column -t
View wlo-widget.php
// Plugin Name: WLO Widget
// register core 'text' widget
register_wlo_widget( 'text' ); // id base
* hook in
function register_wlo_widget( $widget_id ) {
View curl-rest-cli.php
if ( !defined( 'WP_CLI' ) ) return;
class trepmal_cURL_REST extends WP_CLI_Command {
* Generate cURL command for REST API
trepmal / debug-rest-api.php
Last active Mar 1, 2018
Intended for use alongside Debug Bar tools. Do not use in Production.
View debug-rest-api.php
* Plugin Name: Debug Bar for REST API
* Description: Enable Debug Bar for REST API endpoints (add ?debug). Not for production.
* Author: Kailey "trepmal" Lampert
namespace trepmal\rest_debug;
View dev-plugins.php
* Plugin Name: Dev Plugins
add_action( 'muplugins_loaded', function() {
// Plugins to activate automatically.
$auto_activate = [
<some-command> | tee some.log ; \
  ( [[ ${PIPESTATUS[0]} -eq 1 ]] \
  && (tail some.log | mail -s '<some-command> exited with error' \
  || (tail some.log | mail -s '<some-command> finished' )


<some-command> | tee some.log;

echo "mua hahah"

# Uses an escape sequence to move the cursor up.
# So if you `cat` this file, it will hide the "bad" part
# But if you execute the file, the "bad" will be done.
# Try `cat -v` to expose the escape characters.
echo "gooooood file"
# Back up my files and databases
# backup_static_if <fullpath> <shortname>
# use directory fingerprint to avoid unnecessary backups


Update core (and db), plugins, and themes, logging status to syslog. Ideal for running on a cronjob

Example of syslog

Apr 26 04:07:56 vvv vagrant: [WPAutoUpdate] Local WordPress Dev |
Apr 26 04:08:27 vvv vagrant: [WPAutoUpdate] Core update: WordPress updated successfully to 4.5
Apr 26 04:08:28 vvv vagrant: [WPAutoUpdate] DB update: WordPress database already at latest db version 36686
View wp-excerpt-change.php
// Plugin Name: Example. Change "Excerpt" meta box heading
namespace KDL\excerpt_change;
function filter_excerpt( $translations, $text, $domain ) {
if ( $text == 'Excerpt' ) {
return "New Excerpt";
You can’t perform that action at this time.