Skip to content

Instantly share code, notes, and snippets.

View Blake-'s full-sized avatar
🏚️
Working from home

Blake Carver Blake-

🏚️
Working from home
View GitHub Profile
@Blake-
Blake- / gist:319d57679db39618a49decf322415ba4
Created March 16, 2023 15:41
Shell script that returns http code from a list of sites
#!/bin/bash
INPUT=sites.txt
OLDIFS=$IFS
IFS=,
[ ! -f $INPUT ] && { echo "$INPUT file not found"; exit 99; }
while read SITE
do
@Blake-
Blake- / gist:0f2cc54bbdca5fb90cd5e44994d9085a
Created June 17, 2021 14:14
Switch off disable_api_termination on a bunch of ec2s in a terraform file
A bunch of ec2s are created with disable_api_termination true which makes it really hard to kill them all when the time comes.
This just changes all the disable_api_termination vars from true to false so they can easily `terraform destroy`
```
find . -type f -name "app[[:digit:]]*.tf" | xargs sed -i '' 's/disable_api_termination = true/disable_api_termination = false/g'
terraform apply
```
@Blake-
Blake- / update-all-archivesspace-mtimes-to-now.txt
Created June 17, 2020 19:47
Update all ArchivesSpace records to published
UPDATE accession set publish = 1;
UPDATE agent_corporate_entity set publish = 1;
UPDATE agent_family set publish = 1;
UPDATE agent_person set publish = 1;
UPDATE agent_software set publish = 1;
update archival_object set publish = 1;
update classification set publish = 1;
update classification_term set publish = 1;
update digital_object set publish = 1;
@Blake-
Blake- / gist:d493da28be5554a49a3a3835bbd98f05
Created March 13, 2020 15:02
Find Bad Dates In ArchivesSpace Tables
SELECT * FROM accession WHERE user_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM active_edit WHERE user_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM agent_contact WHERE user_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM agent_corporate_entity WHERE user_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM agent_family WHERE user_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM agent_person WHERE user_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM agent_software WHERE user_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM archival_object WHERE user_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM aspace-dts_schema_info WHERE user_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM assessment WHERE user_mtime LIKE '2020-03-08 02:00%'
@Blake-
Blake- / gist:3c133ec7e42d039d85afbad5b3089eb4
Created March 13, 2020 15:02
Find Bad Dates In All ArchivesSpace Tables
SELECT * FROM accession WHERE system_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM active_edit WHERE system_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM agent_contact WHERE system_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM agent_corporate_entity WHERE system_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM agent_family WHERE system_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM agent_person WHERE system_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM agent_software WHERE system_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM archival_object WHERE system_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM aspace-dts_schema_info WHERE system_mtime LIKE '2020-03-08 02:00%'
SELECT * FROM assessment WHERE system_mtime LIKE '2020-03-08 02:00%'
@Blake-
Blake- / gist:1f5aada7b0a05f19b546ebfed64ade68
Created March 13, 2020 15:02
Update All system_mtimes In All ArchivesSpace Tables
Don't Actually Run All The Commands At Once!!!
update accession set system_mtime = NOW();
update active_edit set system_mtime = NOW();
update agent_contact set system_mtime = NOW();
update agent_corporate_entity set system_mtime = NOW();
update agent_family set system_mtime = NOW();
update agent_person set system_mtime = NOW();
update agent_software set system_mtime = NOW();
update archival_object set system_mtime = NOW();
@Blake-
Blake- / gist:538c8d7cc7ade39efc372a3e3e190873
Last active June 1, 2023 14:52
Update all tables in ArchivesSpace to force a reindex
This will force a solr reindex w/o needing to clear out the /data/ directory
UPDATE accession set system_mtime = NOW();
UPDATE agent_contact set system_mtime = NOW();
UPDATE agent_corporate_entity set system_mtime = NOW();
UPDATE agent_family set system_mtime = NOW();
UPDATE agent_person set system_mtime = NOW();
UPDATE agent_software set system_mtime = NOW();
update archival_object set system_mtime = NOW();
update assessment set system_mtime = NOW();
@Blake-
Blake- / gist:3a6a3887a68592430982331fc19b4dea
Created January 13, 2018 14:20
mysql select popular Drupal nodes from a specific year
SELECT node_counter.totalcount as count, node.title, DATE_FORMAT(FROM_UNIXTIME(node.created), '%e %b %Y')
FROM node_counter, node WHERE node.nid = node_counter.nid and
FROM_UNIXTIME(node.created, '%Y') = 1999 order by count desc limit 20
@Blake-
Blake- / gist:fc00725d519a25a55b3c2368d1ee238d
Created October 21, 2017 01:10
Mounting a s3ql file system to the S3 compatible file system at Softlayer on an Ubuntu 16 Xenial VSI
Mounting a s3ql file system to the S3 compatible file system at Softlayer on an Ubuntu 16 Xenial VSI
apt install s3ql
nano /etc/s3ql.authinfo
[softlayer-s3]
backend-login: somelogin
@Blake-
Blake- / gist:96a73ff79b4533e15b919a2f47968b3f
Created March 8, 2017 23:45
Find all WordPress installs on a server and record the version
find /home/ -name 'version.php' -path '*wp-includes/*' -print -exec grep '$wp_version =' {} \; -exec echo '' \; > all-wp-versions-2.txt