Skip to content

Instantly share code, notes, and snippets.

View stilliard's full-sized avatar
🐝

Andrew Stilliard stilliard

🐝
View GitHub Profile
@stilliard
stilliard / ssh-alerts.sh
Created September 23, 2024 17:10
Email on ssh login
# Save file to /etc/profile.d/ssh-alerts.sh
# email on ssh login
if [ -n "$SSH_CLIENT" ]; then
TEXT="$(date): ssh login to ${USER}@$(hostname -f)"
TEXT="$TEXT from $(echo $SSH_CLIENT | awk '{print $1}')"
echo $TEXT | mail -s "ssh login" [email protected]
fi
semantic-commit = "!f() { \
if [ \"$3\" != \"\" ]; then \
git commit -S -m \"$1($2): $3\"; \
else \
git commit -S -m \"$1: $2\"; \
fi \
}; f"
chore = semantic-commit chore
@stilliard
stilliard / scrape.php
Created May 20, 2020 11:20
Scrape some blog posts and their images
<?php
//
// Quickly download some blog posts
//
// setup:
// mkdir -p images/post-{content,logos} # for images
// mkdir out # for the csv output
// composer init -q
// composer require voku/simple_html_dom
@stilliard
stilliard / index.html.twig
Created August 2, 2019 11:50
Page sub category lists in REC
{% include "html/helpers/sub-categories-list.html.twig" with {'parent': page.products_shown_cat_id } %}
@stilliard
stilliard / new-ssh-user.md
Last active July 30, 2019 11:03
New ssh user setup via github key

Set newusername as the account name you want the user to have on the server, & newusergithub as that persons github account name. This then takes their public key used with github and allows the user to login to the server via their ssh key.

newusername=bob
newusergithub=bobsgh

sudo useradd -m -d /home/$newusername -s /bin/bash $newusername
cd /home/$newusername/
sudo mkdir .ssh
<form method="get">
  <input type="search" name="search" value="{{ filters.search | escape }}">
  <button type="submit">Search</button>
  <a href="{{ module.link }}">reset</a>
</form>
@stilliard
stilliard / mod-collection-demo.html.twig
Created July 10, 2019 00:00
module collection demo with tags and search
<style>
.mod-tags {}
.mod-tags .active { font-weight: bold; }
</style>
<h1>{{ module.name }} Collection</h1>
<form action="{{ module.link }}" method="get">
<fieldset>
@stilliard
stilliard / check-for-keys-disabled.sql
Created February 24, 2019 00:33
Check all database's tables to see if keys are disabled
# Will print database name & tables that have keys disabled
SELECT TABLE_SCHEMA, TABLE_NAME
FROM information_schema.STATISTICS
WHERE comment = 'disabled'
GROUP BY TABLE_SCHEMA, TABLE_NAME;
@stilliard
stilliard / github-projects-col-widths-userscript.js
Created June 5, 2018 00:08
Slightly decrease widths of github project board columns
// ==UserScript==
// @name Decrease GitHub projects column widths
// @namespace https://www.wildfireinternet.co.uk/
// @version 0.1
// @description By default the column widths on project boards on github are too big, this decreases them a little
// @author Andrew
// @match https://github.com/*/*/projects/*
// @grant none
// ==/UserScript==
@stilliard
stilliard / github-git-pr-alias
Last active June 7, 2018 01:21
git alias to show link to create or view pull request for current branch
pr = "!f() { git remote get-url origin | sed 's/[email protected]://g' | sed 's/.git//g' | awk '{print \"https://github.com/\"$1\"/pull/'$(git rev-parse --abbrev-ref HEAD)'\"}'; }; f"