Skip to content

Instantly share code, notes, and snippets.

View doublecompile's full-sized avatar

Jonathan Hawk doublecompile

View GitHub Profile
@doublecompile
doublecompile / backup-tiddly.sh
Created July 18, 2015 21:35
TiddlyWiki 5 Backup Script
#!/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 August 6, 2015 21:59
JSON object containing all ISO 3166-1 alpha-2 country codes and names as of 2013.
{
"countries": [
{
"code": "AD",
"name": "Andorra"
},
{
"code": "AE",
"name": "United Arab Emirates"
},
@doublecompile
doublecompile / countries.php
Created August 6, 2015 22:03
PHP array containing all ISO 3166-1 alpha-2 country codes and names as of 2013, sorted by name.
<?php
$countries = [
'AF' => 'Afghanistan',
'AX' => 'Åland Islands',
'AL' => 'Albania',
'DZ' => 'Algeria',
'AS' => 'American Samoa',
'AD' => 'Andorra',
'AO' => 'Angola',
'AI' => 'Anguilla',
@doublecompile
doublecompile / php.ini
Created July 29, 2016 22:50
Typical PHP CLI 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 / install-composer.sh
Created October 16, 2016 20:38
Installs Composer
#!/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 / rotate-wallpaper.sh
Last active April 11, 2017 14:21
Rotates a wallpaper on either Gnome or OS X
#!/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 April 18, 2017 19:33
Setup my dotfiles
#!/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 January 16, 2018 21:20
Typical PHP FPM 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 / search-everything.patch
Created August 22, 2018 20:04
Fixes Search Everything problem
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);
@doublecompile
doublecompile / td-agent.conf
Last active April 10, 2022 07:18
Fluentd configuration for nginx, PHP-FPM, and syslog forwarding to AWS CloudWatch Logs
## 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