Skip to content

Instantly share code, notes, and snippets.

View amccarty's full-sized avatar

Alan McCarty amccarty

View GitHub Profile
@amccarty
amccarty / gist:0568f5028c628d34279725e17ba2ccdb
Created October 5, 2016 23:34
Fedora Commons backup/restore
Fedora Backup:
curl -v -X POST http://localhost:8080/fedora/rest/fcr:backup
(see catalina.out for backup location)
Fedora Restore:
curl -v -X POST -d "[path/to/backup/location]" http://localhost:8080/fedora/rest/fcr:restore
@amccarty
amccarty / gist:efb8b8cfd2a42363cf060ff7778a10f9
Created November 27, 2016 20:47
Elastic Beanstalk memory monitor cron
#.ebextensions/01-memorymon.config
packages:
yum:
perl-Switch: []
perl-DateTime: []
perl-Sys-Syslog: []
container_commands:
00download:
command: "wget http://ec2-downloads.s3.amazonaws.com/cloudwatch-samples/CloudWatchMonitoringScripts-v1.1.0.zip"
@amccarty
amccarty / gist:4688423595c5ed33e74f6bb70d3be211
Created December 1, 2016 13:49
Remove all installed gems
for x in `gem list --no-versions`; do gem uninstall $x -a -x -I; done
@amccarty
amccarty / gist:8e6d0a724ea6113d8bfbf7e452ff9de8
Created December 14, 2016 14:01
Check postgres DB size on disk
SELECT pg_database.datname,
pg_size_pretty(pg_database_size(pg_database.datname)) AS size
FROM pg_database;
@amccarty
amccarty / gist:85a44b0e0a2cea2660c422fdaab9d780
Created January 4, 2017 16:09
AWS: Compare local and S3 object checkums
pwd:[~]: aws s3api head-object --bucket elasticbeanstalk-bucket-name --key foo.zip
{
"AcceptRanges": "bytes",
"ContentType": "application/x-zip",
"LastModified": "Tue, 08 Nov 2016 15:28:46 GMT",
"ContentLength": 174862,
"ETag": "\"02e11bbb865a535196dc3c2f7cad94c5\"",
"Metadata": {}
}
pwd:[~]: md5 foo.zip
@amccarty
amccarty / passenger.case
Created February 21, 2017 14:54
puppet centos case for passenger
/usr/local/share/gems/gems/passenger-4.0.58/buildout/apache2/mod_passenger.so
case $operatingsystem {
CentOS: {
if ! defined (Class ['::passenger']){
class {'::passenger':
passenger_version => $passenger_version,
package_ensure => $passenger_version,
@amccarty
amccarty / gist:c5e5a14e6b45be4279f2c525904f569d
Created March 29, 2017 14:31
Prepend to a sql file before importing via command line
sed -i '1s;^;SET\ FOREIGN_KEY_CHECKS\ =\ 0\;\nSET\ UNIQUE_CHECKS\ = \ 0\;\nSET\ AUTOCOMMIT\ =\ 0\;\n;' scholarsdev-opt.sql
@amccarty
amccarty / undefined.php
Created June 1, 2017 19:25
PHP Notice: Undefined variable: record in /cul/web/fantastic.library.cornell.edu/htdocs/imagerecord.php on line 22
<html>
<head>
<title>Fantastic... Image Record</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body>
<?php include("inc/topData.html") ?>
@amccarty
amccarty / .condarc
Created June 13, 2018 22:28
Conda with conda-forge
conda:
channels:
- defaults
default-channels:
- https://conda.anaconda.org/conda-forge/osx-64
- https://conda.anaconda.org/conda-forge/noarch
- https://repo.continuum.io/pkgs/main
- https://repo.continuum.io/pkgs/free
- https://repo.continuum.io/pkgs/r
- https://repo.continuum.io/pkgs/pro
#!/usr/bin/env bash
set -eux
OS="$(gawk -F= '/^NAME/{print $2}' /etc/os-release | sed 's/"//g')"
echo "Detected ${OS} Distro"
if [[ "$OS" =~ ^(CentOS\ Linux|RedHat|Ubuntu)$ ]]; then