Skip to content

Instantly share code, notes, and snippets.

✏️
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 / nginx-google-domain-csp-map.sh
Created Feb 6, 2020
Use the correct google country domain in your nginx content-security-policy header, instead of all of them
View nginx-google-domain-csp-map.sh
#!/bin/bash
#
# Generates an nginx compatible map that you can use to
# put the relevant Google country code in your Content-Security-Policy
# instead of having them all.
#
# Add these to your nginx config:
# geoip2 /path/to/GeoLite2-Country.mmdb {
# $geoip2_country_code default=US source=$remote_addr country iso_code;
# $geoip2_country_name country names en;
@jaygooby
jaygooby / membash.sh
Created Aug 20, 2019 — forked from goodevilgenius/membash.sh
[membash] BASH script which may be used to interact with memcache. All main memcache functions are supported. #memcache
View membash.sh
#!/bin/bash
# Gist: 11375877
# Url: https://gist.github.com/goodevilgenius/11375877
#
# All memcache functions are supported.
#
# Can also be sourced from other scripts, e.g.
# source membash.sh
# MCSERVER="localhost"
@jaygooby
jaygooby / src-hilite-lesspipe.sh
Last active Apr 21, 2020
A modified version of gnu source-highlight's src-hilite-lesspipe.sh that also works with piped files and files with no extensions. It uses the file command to guess the language. This means you can use source-highlight in conjunction with commands like "git show"
View src-hilite-lesspipe.sh
#! /bin/bash
#
# Based on http://git.savannah.gnu.org/cgit/src-highlite.git/tree/src/src-hilite-lesspipe.sh.in
# by Lorenzo Bettini
#
# Modified by Jay Caines-Gooby to support piped files
# jay@gooby.org
# @jaygooby
#
# Typically called by setting:
@jaygooby
jaygooby / mysql-health-check.sh
Created Aug 29, 2018
Very basic mysql health check
View mysql-health-check.sh
# 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 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
Created Mar 22, 2018
opens all your currently uncommitted files from the 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 Dec 7, 2016 — 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
You can’t perform that action at this time.