Skip to content

Instantly share code, notes, and snippets.

View beveradb's full-sized avatar

Andrew Beveridge ☄️ beveradb

View GitHub Profile
@beveradb
beveradb / Dockerfile
Created July 29, 2024 22:07
Runpod serverless CUDA 12 Dockerfile for audio-separator
# Runpod Base image: https://github.com/runpod/containers/blob/main/official-templates/base/Dockerfile
FROM runpod/base:0.6.2-cuda12.1.0
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb
RUN dpkg -i cuda-keyring_1.1-1_all.deb
RUN apt-get update && apt-get upgrade -y
# Install various needed dependencies
RUN apt-get install -y \
@beveradb
beveradb / deploy.yml
Created July 3, 2024 19:31
Github Actions workflow to deploy a Create React App to Github Pages
name: Build and Deploy to GitHub Pages
on:
push:
branches:
- main
permissions:
contents: read
pages: write
@beveradb
beveradb / midicobackup.sh
Created February 7, 2024 02:59
MidiCo Settings and Preferences Backup Script
#!/bin/bash
# Base directories for backup and application settings
backupDir=~/MidiCoSettingsBackup
libraryDir=~/Library
# Application-specific paths relative to ~/Library
paths=(
"Caches/com.ggs.midico"
"Containers/com.ggs.midico"
@beveradb
beveradb / twilio-catfacts.js
Created May 20, 2023 03:47
Cat facts SMS text number Twilio function, for random fun stickers around Austin!
const request = require('request');
const responsePrefix = "Here's your random cat fact! - ";
const responseSuffix = " - For more cat facts, text again! To learn more, or if you're interested in learning to code, text Andrew on 803-636-3267."
const catFacts = [
"Cats have been domesticated for over 4,000 years.",
"The average lifespan of a cat is around 15 years.",
"Cats use their whiskers to determine if they can fit through a space.",
"A group of cats is called a clowder.",
"Cats have five toes on their front paws and four on their back paws.",
@beveradb
beveradb / remove_emojis.py
Last active May 6, 2023 18:56
Remove emojis from all filenames in current directory
#!/usr/bin/env python3
# One-liner install to /usr/local/bin/remove_emojis
# sudo curl -L https://gist.githubusercontent.com/beveradb/421e1653c056ee5b6770f7d1f05aa760/raw/remove_emojis.py -o /usr/local/bin/remove_emojis && sudo chmod +x /usr/local/bin/remove_emojis
import os
import re
import sys
def remove_emojis(filename):
@beveradb
beveradb / reverse-proxied-iframe-example-for-s8.html
Created April 7, 2022 19:15
reverse-proxied-iframe-example-for-s8.html
<iframe src="/showcase/" id="showcaseiframe"></iframe>
<script>
// Resize iframe to fit contents on load so there's no inner scrollbar
var frame = document.getElementById("showcaseiframe");
frame.onload = function() {
frame.style.height = frame.contentWindow.document.body.scrollHeight + 'px';
frame.style.width = frame.contentWindow.document.body.scrollWidth+'px';
}
</script>
@beveradb
beveradb / direct-load-HTML-example-for-s8.html
Created April 7, 2022 19:13
direct-load-HTML-example-for-s8.html
<div id="embed-showcase"></div>
<script src="https://code.jquery.com/jquery-3.6.0.slim.min.js" integrity="sha256-u7e5khyithlIdTpu22PHhENmPcRdFiHRjhAuHcs05RI=" crossorigin="anonymous"></script>
<script type="text/javascript">
// On page load, fetch HTML from /showcase proxied path and load into div above
jQuery(function() {
jQuery('#embed-showcase')
.load("/showcase/");
});
</script>
@beveradb
beveradb / testing-nginx-reverse-proxy-to-showcase-for-s8.conf
Created April 7, 2022 19:12
Nginx reverse proxy to third party website with rewritten content and working booking process (with limitations) - demo for s8
# Set up the s8.beveradb.com subdomain by default as a reverse proxy to andrew's website with rewrite rule for links, assets etc.
location / {
proxy_ssl_server_name on;
proxy_pass https://andrewbeveridge.co.uk/;
sub_filter_types *;
sub_filter_once off;
sub_filter 'andrewbeveridge.co.uk' 's8.beveradb.com';
}
@beveradb
beveradb / gitsearch.sh
Created March 28, 2022 21:53
Grep the git history for a batch of repos in bulk, to see if a string has ever been referenced in any of the repos
#!/bin/bash
# Usage: gitsearch.sh stringToSearchFor *
#
# If you have a lot of repos to search, you might want to run this in a tmux session and pipe the results into a logfile with tee, e.g.
#
# cd folderWithLotsOfReposInIt
# gitsearch.sh stringToSearchFor * | tee /tmp/gitsearch-stringToSearchFor.log
#
@beveradb
beveradb / bimtwin-local-dev-workflow.md
Created March 2, 2021 06:58
BIM Twin (custom fork of Snipe IT) dev / staging workflow

3 codebases to clone:

On all, switch to the bimtwin-mvp branch where relevant changes are being made.

Local dev: