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:5ecc81a2e4fee5f65702ea7670982e3b
Created March 30, 2016 21:41
Find hits to Apache access log from Tor Exit Nodes
wget -q https://www.dan.me.uk/torlist/ -O - |sort -u > tor-ips.txt
cat /var/log/apache2/other_vhosts_access.log | awk '{print $2}' |sort -u > all-ips
comm -12 tor-ips.txt all-ips > tor-hits
grep -f tor-hits /var/log/apache2/other_vhosts_access.log
`note www.dan.me.uk limits 1 pull every 30 minutes`
First, you’ll need to install support for Python virtualenvs. Although some folks have said not to use sudo when installing via Pip, I found it necessary:
sudo -H pip install virtualenv
Note that you might need to install Pip first, which—fortunately—is pretty straightforward (easy_install pip).
Once you have virtualenv support installed, then create a virtualenv into which you’ll install the Ansible dependencies:
virtualenv --system-site-packages ansible
This will create a virtualenv called “ansible” in a directory named “ansible” in the current working directory. I used the --system-site-packages flag to allow this virtualenv to have access to the system site packages. I saw various recommendations both for and against this approach; my line of thinking was that this would help prevent some duplication of modules.
@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
@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: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: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: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: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: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- / 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;