Skip to content

Instantly share code, notes, and snippets.

View jaygooby's full-sized avatar
✏️
working on https://writiny.com in my sparse spare time

Jay Caines-Gooby jaygooby

✏️
working on https://writiny.com in my sparse spare time
View GitHub Profile
@jaygooby
jaygooby / mysql-health-check.sh
Created August 29, 2018 15:17
Very basic mysql health check
# A very basic mysql health check that can be used by e.g.
# Consul's External Service Monitor
#
# Cobbled together by @jaygooby from a combination of:
# Unai Rodriguez's and Alex Williams'
# https://gist.github.com/aw/1071144
# and George Chilumbu's
# https://georgechilumbu.wordpress.com/2017/07/27/setup-a-consul-client/
#
# This script checks if a mysql server is healthy running on $MYSQL_HOST.
@jaygooby
jaygooby / ttfb.sh
Last active March 26, 2019 13:44 — forked from sandeepraju/ttfb.sh
curl command to check the time to first byte
# Moved to https://github.com/jaygooby/ttfb.sh
@jaygooby
jaygooby / up-and-atom
Last active January 18, 2021 08:12
Opens all your currently uncommitted files from `$PWD` in Atom, ready for a shiny new day of productive work
# I've got this as an alias, but you could just save it to ~/bin etc
#
# You don't have to use atom either, it would work just as well with subl or vim or whatever,
# only the pun's not as good then...
atom . $(git status --porcelain | cut -d" " -f3 | xargs -I {} echo './'{} | xargs)
#!/bin/bash
#
# Do you need a cluster of http servers to test your nginx proxying set up?
# I did, so I wrote this. https://twitter.com/jaygooby
#
# Defaults to starting 5 servers on 127.0.0.1 ports 2000 - 2004
# You can optionally specify the starting port and the number of servers you need...
#
# START_PORT=8000 NUM_SERVERS=9 bash_http_cluster.sh
#
<?php
// Check if your Wordpress install is vulnerable to
// https://exploitbox.io/vuln/WordPress-Exploit-4-6-RCE-CODE-EXEC-CVE-2016-10033.html
//
// After you've saved this to your docroot/wp-content folder, you can call
// curl -sH "Host: vulnerable" http://example.com/wp-content/vars.php | grep SERVER_NAME | grep vulnerable
// where example.com is your actual wordpress domain.
//
// If you see nothing, you're fine; you're either running nginx or the patched version of Wordpress.
// If you see [SERVER_NAME] => vulnerable, then you should patch ASAP
@jaygooby
jaygooby / jack.rb
Last active November 20, 2020 23:32 — forked from edwardgeorge/jack.rb
Homebrew formula to install JackOSX binary package.
require 'formula'
class Jack <Formula
homepage 'http://jackaudio.org'
version '0.90'
url 'https://dl.dropboxusercontent.com/u/28869550/JackOSX.0.90.zip'
def install
system "xar -xf JackOSX.0.90.pkg"
@jaygooby
jaygooby / monit-alert-slack.sh
Last active April 12, 2017 12:10
Pipe your Monit email alerts into Slack
#!/bin/bash
# Save this file as e.g. /usr/local/bin/monit-alert-slack.sh
# then chmod +x /usr/local/bin/monit-alert-slack.sh
#
# In your /etc/monitrc set a user to get the alerts you
# want pushed to Slack:
#
# set alert monit-alerts@localhost
#
# and then in /etc/aliases set this as the user which
@jaygooby
jaygooby / README.md
Last active May 19, 2016 15:17
Run your own remote server that you can ssh to? You can use it to host your own private git repositories...

Run your own remote server that you can ssh to? You can use it to host your own private git repositories - they're just directories that have been git init --bare.

Use this script to create new remote repositories, list existing and get simple help for cloning or adding them as remotes.

Save this script to the remote server (e.g. ~/bin/repo-man.sh), and then invoke from your local machine like this:

ssh -t you@example.com "~/bin/repo-man.sh"
#!/bin/sh
#
# S3rep.sh version 1.0
# Copyright 2009 Matthew Staver
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
@jaygooby
jaygooby / combine-pdf.sh
Last active August 29, 2015 14:09
Combine multiple pdfs, potentially with spaces in their name, using pdftk and xargs
#!/bin/bash
#
# Props to http://www.lornajane.net/posts/2011/combining-pdf-files-with-pdftk
# found via http://stackoverflow.com/questions/19122448/bash-escaping-spaces-in-filename-in-variable#comment42365877_19122448
#
# here the sort is used because the pdfs are named something like page 01.pdf page 02.pdf and the -z means the whitespace
# doesn't cause any issues
find ./somepath -name "*.pdf" -print0 | sort -z | xargs -0 -J % pdftk % cat output out.pdf