Skip to content

Instantly share code, notes, and snippets.

Avatar

Jonathan Hawk doublecompile

View GitHub Profile
@doublecompile
doublecompile / backup-tiddly.sh
Created Jul 18, 2015
TiddlyWiki 5 Backup Script
View backup-tiddly.sh
#!/bin/bash
TIDDLY_HTML="$HOME/tiddly.html"
TIDDLY_BACK="$HOME/.tiddly"
lastback=`ls -Frt $TIDDLY_BACK | grep "[^/]$" | tail -n 1`
hash1=`md5sum $TIDDLY_BACK/$lastback | awk '{ print $1 }'`
hash2=`md5sum $TIDDLY_HTML | awk '{ print $1 }'`
if [ "$hash1" != "$hash2" ] ; then
@doublecompile
doublecompile / countries.json
Created Aug 6, 2015
JSON object containing all ISO 3166-1 alpha-2 country codes and names as of 2013.
View countries.json
{
"countries": [
{
"code": "AD",
"name": "Andorra"
},
{
"code": "AE",
"name": "United Arab Emirates"
},
@doublecompile
doublecompile / countries.php
Created Aug 6, 2015
PHP array containing all ISO 3166-1 alpha-2 country codes and names as of 2013, sorted by name.
View countries.php
<?php
$countries = [
'AF' => 'Afghanistan',
'AX' => 'Åland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
@doublecompile
doublecompile / rotate-wallpaper.sh
Last active Apr 11, 2017
Rotates a wallpaper on either Gnome or OS X
View rotate-wallpaper.sh
#!/bin/bash
# Rotate wallpapers on GNOME or OSX
# (OSX users need to install coreutils)
set -e
WALLPAPERS="$HOME/wallpaper"
if [[ -n "$(command -v gsettings)" ]]; then
paper=`find $WALLPAPERS -type f | shuf -n 1`
PID=$(pgrep gnome-session)
@doublecompile
doublecompile / setup.sh
Last active Apr 18, 2017
Setup my dotfiles
View setup.sh
#!/bin/sh
if [ -n "$(command -v yum)" ]; then
sudo yum -y install git
elif [ -n "$(command -v apt-get)" ]; then
sudo apt-get update
sudo apt-get install -y git stow
fi
pwd=$(pwd)
git clone https://github.com/doublecompile/dotfiles.git ~/dotfiles
rm ~/.bashrc
@doublecompile
doublecompile / php.ini
Last active Jan 16, 2018
Typical PHP FPM ini
View php.ini
[PHP]
engine = On
short_open_tag = Off
output_buffering = Off
zlib.output_compression = Off
default_charset = "UTF-8"
disable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority
zend.enable_gc = On
max_execution_time = 240
memory_limit = 128M
@doublecompile
doublecompile / php.ini
Created Jul 29, 2016
Typical PHP CLI ini
View php.ini
[PHP]
engine = On
short_open_tag = Off
zlib.output_compression = Off
max_execution_time = 120
max_input_time = 120
memory_limit = -1
default_charset = "UTF-8"
error_reporting = E_ALL
display_errors = On
@doublecompile
doublecompile / td-agent.conf
Last active Apr 10, 2022
Fluentd configuration for nginx, PHP-FPM, and syslog forwarding to AWS CloudWatch Logs
View td-agent.conf
## This configuration file expects certain environment variables to be available.
## You can add them to /etc/default/td-agent:
## AWS_REGION
## AWS_VPC_ID
## AWS_INSTANCE_ID
<source>
@type syslog
port 42185
bind 127.0.0.1
tag rsyslog
View install-composer.sh
#!/bin/sh
EXPECTED_SIGNATURE=$(wget https://composer.github.io/installer.sig -O - -q)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" = "$ACTUAL_SIGNATURE" ]
then
php composer-setup.php --quiet
RESULT=$?
@doublecompile
doublecompile / search-everything.patch
Created Aug 22, 2018
Fixes Search Everything problem
View search-everything.patch
diff --git a/wp-content/plugins/search-everything/search-everything.php b/wp-content/plugins/search-everything/search-everything.php
index d39281c5..a3fa4d63 100644
--- a/wp-content/plugins/search-everything/search-everything.php
+++ b/wp-content/plugins/search-everything/search-everything.php
@@ -275,7 +275,8 @@ class SearchEverything {
$searchQuery .= $this->se_search_authors();
}
- if ( $searchQuery != '' ) {
+ $searchQuery = trim($searchQuery);