Skip to content

Instantly share code, notes, and snippets.

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 / ttfb.sh
Last active Mar 26, 2019 — forked from sandeepraju/ttfb.sh
curl command to check the time to first byte
View ttfb.sh
# Moved to https://github.com/jaygooby/ttfb.sh
@jaygooby
jaygooby / up-and-atom
Last active Jan 18, 2021
Opens all your currently uncommitted files from `$PWD` in Atom, ready for a shiny new day of productive work
View up-and-atom
# 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)
View bash_http_cluster.sh
#!/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
#
View vars.php
<?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 Nov 20, 2020 — forked from edwardgeorge/jack.rb
Homebrew formula to install JackOSX binary package.
View jack.rb
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 Apr 12, 2017
Pipe your Monit email alerts into Slack
View monit-alert-slack.sh
#!/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
Run your own remote server that you can ssh to? You can use it to host your own private git repositories...
View README.md

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"
View s3rep.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 Aug 29, 2015
Combine multiple pdfs, potentially with spaces in their name, using pdftk and xargs
View combine-pdf.sh
#!/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
View example output
add_index :attachments, :parent_id
add_index :attachments, :asset_id
add_index :domain_names, :user_id
add_index :domain_names, :event_id
add_index :event_memberships, :user_id
add_index :event_memberships, :event_id
remove_index :attachments, :parent_id
remove_index :attachments, :asset_id
remove_index:domain_names, :user_id
remove_index:domain_names, :event_id