Skip to content

Instantly share code, notes, and snippets.

View markpbaggett's full-sized avatar

Mark Baggett markpbaggett

View GitHub Profile

Islandora Code Club

July 9, 2015

Agenda / Goals

  • Using the devel module
  • Look at what tuque is doing
  • Look at code and look at how it is on the site

Notes

@markpbaggett
markpbaggett / rsycxml.sh
Last active January 17, 2017 17:42
Rsync to Grab XML files in a path only
$ rsync -a -v -z --include='*/' --include='*.xml' --exclude='*' user@server:/path/to/files/ local/path/to/wherever/
# -a = recursive, timestamps, etc, etc
# -v = verbose (not really necessary, but why not?)
# -z = compression because we can!
# --include='*/' = include all directories!
# --include='*.xml' = include this kind of file, wherever they occur in those directories!
# --exclude='*' = exclude everything *but* the stuff we're including!
# you know the rest
@markpbaggett
markpbaggett / drush_add_theme.sh
Created August 31, 2016 21:31
vagrant_theme_enable
#!/bin/bash
echo "drush enable theme"
sudo chown -hR vagrant:www-data "$DRUPAL_HOME"/sites/all/themes
sudo chmod -R 755 "$DRUPAL_HOME"/sites/all/themes
cd "$DRUPAL_HOME"/sites/all/themes || exit
git clone https://github.com/utkdigitalinitiatives/UTKdrupal
drush -y -u 1 en pm-enable UTKdrupal
#drush -y -u 1 en vset theme_default UTKdrupal
@markpbaggett
markpbaggett / 0_reuse_code.js
Created December 6, 2016 15:35
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@markpbaggett
markpbaggett / template.rb
Created February 17, 2017 00:32
GeoBlacklight Template File
gem 'blacklight', '>= 6.3'
gem 'geoblacklight', '>= 1.3'
gem 'jettywrapper', '>=2.0.4'
run 'bundle install'
generate 'blacklight:install', '--devise'
generate 'geoblacklight:install', '-f'
rake 'db:migrate'
@markpbaggett
markpbaggett / saxon-xslt.sh
Created May 24, 2017 18:37
Saxon Executable
#!/bin/bash
exec java -cp /home/mark/opt/saxon9/saxon9he.jar net.sf.saxon.Transform "$@"
@markpbaggett
markpbaggett / examle_sed.sh
Created May 24, 2017 19:04
Example sed script
#!/bin/bash
for X in *.xml; do sed -i_BAK -e 's/\ xlink=/ xlink:href=/g' $X; done
@markpbaggett
markpbaggett / git_lower.py
Last active April 16, 2018 13:14
Git mv all files to lowercase.
import os
from subprocess import call
path = "XSLT"
for x in os.listdir(path):
if x != x.lower():
file = x.lower()
call(f"git mv {path}/{x} {path}/{file}", shell=True)
@markpbaggett
markpbaggett / gist:fd599485a2b7bc02f383b6afb23b72d1
Created April 18, 2019 12:52
Addressing Dependency Problems in Pipenv (like always happens with black)
pipenv lock --pre --clear
@markpbaggett
markpbaggett / replace.py
Last active October 11, 2019 21:13
ArchivesSpace replace double comma
def replace_double_commas_in_archival_object(self, id, repo_id=2):
metadata_from_archival_object = self.get_archival_object(id, repo_id)
title = metadata_from_archival_object['title']
if title.endswith(','):
title = title[:-1]
metadata_from_archival_object['title'] = title
r = requests.post(
url=f'{self.base_url}/repositories/{repo_id}/archival_objects/{id}',
headers=self.headers,
data=json.dumps(metadata_from_archival_object)