Skip to content

Instantly share code, notes, and snippets.

View iAugur's full-sized avatar

George Boobyer iAugur

View GitHub Profile
@iAugur
iAugur / ansible-add-string-to-line.yml
Last active March 13, 2026 11:50
Ansible: Add a String to an existing line in a file
# Adapted from solution provided by http://stackoverflow.com/users/57719/chin-huang http://stackoverflow.com/a/31465939/348868
# Scenario: You want to add a group to the list of the AllowGroups in ssh_config
# before:
# AllowGroups Group1
# After:
# AllowGroups Group1 Group2
- name: Add Group to AllowGroups
replace:
backup: yes
@iAugur
iAugur / A-readme.txt
Last active May 22, 2025 13:08
Adding a Reset Button to a Drupal form
I have come across a lot of discussions about how to add a reset button to a form in Drupal 7.
If you search for 'add a reset button to a drupal form' you will find loads of examples using the #markup method of adding html for a reset button. This is because using the render array to add a button #type=> 'button' gives the button a class of 'form-submit'.
But you can use the render array and simply give the button a '#button_type' which translates into a class. Buttons on a form default to submit and that is why they get a class of form-submit. But make the type 'reset' and it will get a class of form-reset.
@iAugur
iAugur / README.md
Last active April 4, 2025 11:03
Make SVGs Unique with random prefix for element ids

SVGs must have unique IDS

Background

If an SVG uses things like gradients, clip paths, masks, classes etc then these must have unique names/ids if they are show on a page with other similar SVG. As would be the case with HTML for example

This can be encountered when SVGs don't display correctly - especially ones using clippaths - when show on a page with other similar SVGs, but display OK when shown alone.

They will also fail accessibility checks (WCAG 2.1 (A), WCAG 2.0 (A)).

@iAugur
iAugur / wget.txt
Last active March 19, 2025 12:19 — forked from suzannealdrich/wget.txt
wget spider cache warmer
wget --spider -o wget.log -e robots=off -r -l 5 -p -S -T3 --header="X-Bypass-Cache: 1" -H --domains=live-mysite.mydomain.com --show-progress live-mysite.mydomain.com
# Options explained
# --spider: Crawl the site
# -o wget.log: Keep the log
# -e robots=off: Ignore robots.txt
# -r: specify recursive download
# -l 5: Depth to search. I.e 1 means 'crawl the homepages'.  2 means 'crawl the homepage and all pages it links to'...
# -p: get all images, etc. needed to display HTML page
# -S: print server response (to the log)
@iAugur
iAugur / Ansible-apache-validate-README.md
Last active June 23, 2023 07:45
Testing Apache configuration with Ansible templates
@iAugur
iAugur / php_substring_html.php
Last active March 2, 2023 16:12 — forked from getmanzooronline/php_substring_html.php
PHP Substring without breaking words and HTML tags
<?php
/**
* Truncates text.
*
* Cuts a string to the length of $length and replaces the last characters
* with the ending if the text is longer than length.
*
* @param string $text String to truncate.
* @param integer $length Length of returned string, including ellipsis.
* @param string $ending Ending to be appended to the trimmed string.
@iAugur
iAugur / Orgchart.html
Created July 1, 2022 17:38
Organisation diagram with Raphaeljs
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="[add your bin description]">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Organisation Chart</title>
</head>
<body>
<div id="container"></div>
@iAugur
iAugur / README.md
Last active April 8, 2022 10:03
Dropping Tables from a Mysql/Mariadb database

Drop all tables in a Mysql DB

It's not always that easy to drop all of the tables in a db

But here are two great ways:

  1. Use a script to enumerate all of the tables and drop them one by one
  2. Use mysqldump to create a dump with just the schema statements and grep out the drop tables
@iAugur
iAugur / README.md
Last active April 8, 2022 09:57
Fail2ban jail for abusive SQL injection attempts in User Agent String

This is an example of a custom Fail2Ban filter

It matches SQL injection attempts via the User Agent string

@iAugur
iAugur / Apache Better Blocking with common rules.txt
Last active February 14, 2022 14:28
Apache: Better Blocking with common rules
Following on from other Gists I have posted, this one shows a neat way of using Includes to centralise general blocking rules for Bad Bots, creepy crawlers and irritating IPs
see the full post at http://www.blue-bag.com/blog/apache-better-blocking-common-rules