Instantly share code, notes, and snippets.

View gist:7125b5cfa1bd48d8da0e9ad89256c802
polybar config
[module/date]
type = custom/script
exec = ~/scripts/popup-calendar.sh
interval = 5
click-left = ~/scripts/popup-calendar.sh --popup
format-background = ${colors.alt-background}
format-foreground = ${colors.alt-foreground}
label = %output:25%
View read-backlight.py
#!/usr/bin/env python
import sys
import array
import usb.core
import usb.util
import os
path = "/tmp/backlight-value"
# decimal vendor and product values
View gist:a10bebe067d517455e423eb32f7d1d3d
<?php
$to = "receipt@domain.com";
$subject = "My Multipart test";
$message = "I am the plain text message";
$boundary = uniqid(rand(), true);
$header = "MIME-Version: 1.0\n"
View options-monitor.sh
#!/bin/bash
OPTIND=1
verbose=0
dbuser=""
dbpasswd=""
while getopts "vh?U:P:H:" opt; do
case "$opt" in
View minions-post-pusher.php
<?php
/**
* Plugin Name: WP Minions Post Pusher
* Description: Pushes all published posts to one blog using wp-minions
* Version: 1.0
* Author: Thorsten ott
* Author URI: http://thorsten-ott.de/
* License: GPLv2 or later
*/
View gist:2fb5a32786542c3b423faf007b085d74
#!/bin/bash
# ./curl-urls.sh numprocessses http://urltograp urlpattern
# ./curl-urls.sh 3 http://www.domain.com domain.com
numprocessses=$1
baseurl=$2
urlpattern=$3
function forky() {
local num_par_procs
if [[ -z $1 ]] ; then
View gist:a7638cb9b602425b3c87
/**
* Disable xmlrpc
*/
if ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
include_once(ABSPATH . WPINC . '/class-IXR.php');
class blocking_xmlrpc_server {
function serve_request() {
$response = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
die( $response->getXml() );
View gist:0cc78e7dcad18024d1c8
for i in `wp site list | cut -f 2 | grep -v url`; do wp --url=$i eval 'global $wpdb, $blog_id; $blogname=get_option("blogname"); $blogurl=home_url(); $domains=$wpdb->get_results( "SELECT * FROM {$wpdb->dmtable} WHERE blog_id = $blog_id;" ); foreach( $domains as $data ) { echo $blog_id.",".$blogname.",".$blogurl.",".$data->domain.",".$data->active."\n"; }'; done
View maybe-flush-rewrite-rules.php
function maybe_flush_rules() {
global $wp_rewrite;
$rewrite_rules = get_option( 'rewrite_rules' );
foreach( $rewrite_rules as $rule => $rewrite ) {
$rewrite_rules_array[$rule]['rewrite'] = $rewrite;
}
$maybe_missing = $wp_rewrite->rewrite_rules();
$missing_rules = false;
$rewrite_rules_array = array_reverse( $rewrite_rules_array, true );
foreach( $maybe_missing as $rule => $rewrite ) {
View harvest-bugger.php
<?php
/**
* Helper script that can be run in cron to bug you when you forgot to run a harvest timer.
* install terminal-notifier via:
* sudo gem install terminal-notifier
* Make sure to adjust your credentials.
* Schedule via crontab -e to run weekdays 9-5
* <star>/10 09-17 * * 1-5 php <path-to-script>
* replace <star> with *
*/