Skip to content

Instantly share code, notes, and snippets.

View wesort's full-sized avatar

Ben Edmonds wesort

View GitHub Profile
@wesort
wesort / s3cmd.md
Last active November 22, 2024 16:21

s3cmd

This is a command line tool for syncing with DigitalOcean Spaces or Amazon S3.

I'm using this in the context of .gitignore'ing Assets from a Statamic site.

DigitalOcean Spaces with s3cmd

Install & configure

s3cmd setup

  • SSH into server
@wesort
wesort / nginx.conf
Created March 16, 2023 15:09
nginx location / { ... } for Nuxt
location / {
proxy_pass http://localhost:3000/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
@wesort
wesort / lifecycle.xml
Last active July 30, 2024 16:10
Example for applying expiration policy on Digitalocean Spaces
<LifecycleConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Rule>
<ID>Prune files starting with backup- after 30 days</ID>
<Prefix>backup-</Prefix>
<Status>Enabled</Status>
<Expiration>
<Days>30</Days>
</Expiration>
</Rule>
</LifecycleConfiguration>
@wesort
wesort / legacy-redirects.md
Created April 29, 2024 08:40
Redirects.map for bulk redirect of URLs via nginx.conf

Redirects

docs/legacy-redirects.map: a file listing source and destination (separated by a space) ending each line with a ;

/source /destination;
/news/old-post-2005 /blog;

nginx.conf as set via forge.laravel.com

AFTER include (L1) (NB: edit the domain)

@wesort
wesort / gist:849f3c6d35464a8b02cea105cc1bb95b
Created July 4, 2024 12:37
wget command to archive a website
wget -e robots=off --mirror --page-requisites --convert-links --adjust-extension --no-if-modified-since --no-check-certificate --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36" https://example.com
@wesort
wesort / git-filter-repo.md
Created July 30, 2024 16:42
Using git-filter-repo to rewrite history

Remove large or sensitive files

Warning: This process rewrites history. Teams beware!

I've found this useful to remove images from being stored within a Statamic website's repo and instead being backed-up to Digitalocean spaces. GitHub recommends this and I've followed this process a few times. Your mileage may vary.


1. Check current size of repo (on dev server or locally):

  • Nav to repo