Skip to content

Instantly share code, notes, and snippets.

View stilliard's full-sized avatar
🐝

Andrew Stilliard stilliard

🐝
View GitHub Profile
@stilliard
stilliard / gmail-strickthrough.js
Created May 24, 2016 10:00
gmail strickthrough
// Highlight text
// then open console and run:
document.execCommand('strikeThrough')
@stilliard
stilliard / set_nasa_background_image.sh
Last active November 20, 2017 17:41
nasa apod background - xubuntu / XFCE
#!/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
@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/git@github.com://g' | sed 's/.git//g' | awk '{print \"https://github.com/\"$1\"/pull/'$(git rev-parse --abbrev-ref HEAD)'\"}'; }; f"
@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 / 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>
<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 / 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
@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 / gdrive-backup-setup.sh
Last active May 8, 2020 22:24
Backup server files with Google Drive
# ref: https://github.com/prasmussen/gdrive
# prerequisite:
# In google drive, setup your folder for storing the backups
# Then grab the code from the url e.g. https://drive.google.com/drive/folders/xxxxx where xxxxx is the code
# This code will be used later in the cron command, keep it secret, keep it safe
# install gdrive sync for backups
wget https://drive.google.com/uc?id=0B3X9GlR6EmbnQ0FtZmJJUXEyRTA -O /usr/local/bin/gdrive
chmod 755 /usr/local/bin/gdrive
@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