Skip to content

Instantly share code, notes, and snippets.

🐝

Andrew Stilliard stilliard

🐝
Block or report user

Report or block stilliard

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@stilliard
stilliard / scrape.php
Created May 20, 2020
Scrape some blog posts and their images
View scrape.php
<?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 Aug 2, 2019
Page sub category lists in REC
View index.html.twig
{% include "html/helpers/sub-categories-list.html.twig" with {'parent': page.products_shown_cat_id } %}
@stilliard
stilliard / new-ssh-user.md
Last active Jul 30, 2019
New ssh user setup via github key
View new-ssh-user.md

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
View mod-collection-simple-demo.html.twig
<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 Jul 10, 2019
module collection demo with tags and search
View mod-collection-demo.html.twig
<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 Feb 24, 2019
Check all database's tables to see if keys are disabled
View check-for-keys-disabled.sql
# 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 Jun 5, 2018
Slightly decrease widths of github project board columns
View github-projects-col-widths-userscript.js
// ==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 Jun 7, 2018
git alias to show link to create or view pull request for current branch
View github-git-pr-alias
pr = "!f() { git remote get-url origin | sed 's/git@github.com://g' | sed 's/.git//g' | awk '{print \"https://github.com/\"$1\"/pull/'$(git rev-parse --abbrev-ref HEAD)'\"}'; }; f"
@stilliard
stilliard / set_nasa_background_image.sh
Last active Nov 20, 2017
nasa apod background - xubuntu / XFCE
View set_nasa_background_image.sh
#!/bin/bash
#
# Nasa Image Of The Day As Background
# Originally inspired by https://github.com/stblackbird/nasa-apod-background
#
# config
RESOLUTION_X=1360
RESOLUTION_Y=768
View setup-2gb-swap-partition.sh
# 2gb example
# ref: https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps
cd /var
touch swap.img
chmod 600 swap.img
dd if=/dev/zero of=/var/swap.img bs=2048k count=1000
mkswap /var/swap.img
swapon /var/swap.img
echo "/var/swap.img none swap sw 0 0" >> /etc/fstab
You can’t perform that action at this time.