Skip to content

Instantly share code, notes, and snippets.

View geerlingguy's full-sized avatar
:shipit:
Tea, Earl Grey, hot.

Jeff Geerling geerlingguy

:shipit:
Tea, Earl Grey, hot.
View GitHub Profile
@geerlingguy
geerlingguy / travis-ci-docker-upgrade.sh
Last active August 12, 2020 19:41
Upgrade Docker CE version in Travis CI environments
#!/bin/bash
#
# See: https://docs.travis-ci.com/user/docker/#installing-a-newer-docker-version
#
# Add the following in your .travis.yml file to upgrade Docker prior to your build:
#
# before_install:
# - curl https://gist.githubusercontent.com/geerlingguy/ce883ad4aec6a5f1187ef93bd338511e/raw/36612d28981d92863f839c5aefe5b7dd7193d6c6/travis-ci-docker-upgrade.sh | sudo bash
#
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@geerlingguy
geerlingguy / molecule-3-up.sh
Last active January 15, 2021 13:52
Molecule 3.0 update script with all the little changes I had to make.
#!/bin/bash
#
# Update things to be compatible with Molecule 3.0.
#
# This script is NOT idempotent, and should never be run again.
exit 1
export LINT_STRING="lint: |
set -e
yamllint .
@geerlingguy
geerlingguy / apple-tv-status.php
Last active March 4, 2021 22:41
Simple script to use the Ping PHP library and print a list of servers and their statuses. Written for a school that needs to track whether some local Apple TVs are active.
<?php
/**
* @file
* Show the status of various Apple TVs.
*/
// Place Ping.php in the same folder as this script.
require_once('Ping.php');
@geerlingguy
geerlingguy / systembuttons.py
Last active October 17, 2021 02:19
Python 3 version of Null 2 systembuttons.py
#!/usr/bin/python3
# Shutdown and volume control
import keyboard
import time
import os
INITIAL_VOLUME = "25%"
def shutdown():
# In YAML, this...
something:
- { name: test.example }
# ...is the same as this:
something:
- name: test.example
# And this:
something:
@geerlingguy
geerlingguy / stable-diffusion-ubuntu-2204-nvidia
Last active October 10, 2022 08:51
Install Stable Diffusion on an Nvidia GPU PC running Ubuntu 22.04
# Note: This will only work on (which?) GPUs.
# Install Conda (latest from https://docs.conda.io/en/latest/miniconda.html#linux-installers)
wget https://repo.anaconda.com/miniconda/Miniconda3-py39_4.12.0-Linux-x86_64.sh
bash Miniconda3-py39_4.12.0-Linux-x86_64.sh
# follow the prompts, restart your Terminal session, and run `conda` to confirm it installed.
# Install git and curl, and clone the stable-diffusion repo
sudo apt install -y git curl
cd Downloads
@geerlingguy
geerlingguy / stable-diffusion-webui-on-ubuntu.txt
Last active October 14, 2022 04:05
Install Stable Diffusion WebUI on Ubuntu 22.04 with Nvidia GPU
# First install Docker and docker-compose following this guide:
# https://docs.docker.com/engine/install/ubuntu/
#
# Make sure you add your user to the `docker` group:
sudo usermod -aG docker $USER
# ...then log out and log back in to make that take effect. (I actually had to reboot, le sigh)
# Second install the NVIDIA Container Toolkit following this guide:
# https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/install-guide.html#setting-up-nvidia-container-toolkit
@geerlingguy
geerlingguy / handbrake-batch.sh
Created October 24, 2022 14:13
Handbrake CLI batch transcoding script
#!/bin/bash
#
# This script requires HandBrakeCLI. On macOS, at least, you need to download
# and install it separately from Handbrake.
#
# See: https://handbrake.fr/downloads2.php
if [ -z "$1" ] ; then
TRANSCODEDIR="."
else
@geerlingguy
geerlingguy / cache-purge.yml
Last active November 30, 2022 19:26
Cache purge script to clear Nginx + Cloudflare cache for a given set of URLs.
---
- hosts: webserver
become: true
gather_facts: false
vars:
# API token should be created with cache_purge permissions.
cloudflare_purge_zone: [zone id from cloudflare]
cloudflare_purge_token: "{{ lookup('env','CLOUDFLARE_PURGE_TOKEN') }}"
cloudflare_purge_body:
@geerlingguy
geerlingguy / membash.sh
Created August 2, 2019 15:13 — forked from goodevilgenius/membash.sh
[membash] BASH script which may be used to interact with memcache. All main memcache functions are supported. #memcache
#!/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"