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 / netblock-from-whois
Last active Jun 28, 2022
Gets and caches the netblock owner from `whois` for an IP address
View netblock-from-whois
#!/bin/bash
#
#
# MIT License
#
# Copyright (c) 2022 Jay Caines-Gooby, @jaygooby, jay@gooby.org
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
@jaygooby
jaygooby / what-user-agent
Last active Dec 15, 2021
bash script to humanize user-agent strings using the whatismybrowser.com API
View what-user-agent
Moved to https://github.com/jaygooby/what-user-agent
@jaygooby
jaygooby / log4j-jndi.conf
Last active Feb 2, 2022
fail2ban filter rule for the log4j CVE-2021-44228 exploit
View log4j-jndi.conf
# log4j jndi exploit CVE-2021-44228 filter
# Save this file as /etc/fail2ban/filter.d/log4j-jndi.conf
# then copy and uncomment the [log4j-jndi] section
# to /etc/fail2ban/jail.local
#
# jay@gooby.org
# https://jay.gooby.org/2021/12/13/a-fail2ban-filter-for-the-log4j-cve-2021-44228
# https://gist.github.com/jaygooby/3502143639e09bb694e9c0f3c6203949
# Thanks to https://gist.github.com/kocour for a better regex
#
@jaygooby
jaygooby / kaslurp
Last active Dec 8, 2021
A REPL wrapper for kaput-cli to download files from put.io
View kaslurp
Now https://github.com/jaygooby/kaslurp
View interesting-referers
#!/bin/bash
#
# MIT License
#
# Copyright (c) 2021 Jay Caines-Gooby, @jaygooby, jay@gooby.org
#
# The one-liner from https://jay.gooby.org/2021/11/30/find-interesting-referers-in-access-log
#
# Usage: interesting-referers /path/to/access.log
# interesting-referers /path/to/access.log example.com
View unknown-host
#!/bin/bash
#
# https://jay.gooby.org/2021/02/10/unknown-host
#
# Use this to remove the offending line from your
# ~/.ssh/known-hosts file when you know the host
# has actually changed and you get the
#
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@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 Sep 3, 2021
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.