Skip to content

Instantly share code, notes, and snippets.

View bryjbrown's full-sized avatar
💾
Loading...

Bryan J. Brown bryjbrown

💾
Loading...
View GitHub Profile
#!/usr/bin/env bash
PREFIX='10.00000';
USERNAME='username'
PASSWORD='password'
TESTMODE=true;
FILE='path/to/file.xml'
if $TESTMODE
then
#!/usr/bin/env php
<?php
// User Settings
$doi_prefix = '10.00000';
$username = 'username';
$password = 'password';
$file_path = '/path/to/file.xml';
$test_mode= TRUE;
@bryjbrown
bryjbrown / micah-keynotes.md
Created July 22, 2016 14:58
Notes from Micah's keynote

Digital, Data, Documentation? We're not in ScholComm Kansas Anymore

Mississippi State University Scholarly Communication Summit
Friday, July 22 @ 9:15AM

What is Scholcomm Kansas?

  • Kansas has a strong history in Scholarly Communication
  • "ScholComm Kansas" = traditional scholarly Communication
    • Authors Rights
    • OA
  • IRs
<?php
function getCollectionData($collection_pid) {
$user = user_load(1);
$repository = islandora_get_tuque_connection($user);
$query = <<<EOQ
SELECT ?pid ?label ?cmodel
FROM <#ri>
WHERE {
?pid <info:fedora/fedora-system:def/relations-external#isMemberOfCollection> <info:fedora/$collection_pid> ;
<fedora-model:label> ?label ;
@bryjbrown
bryjbrown / filelist.py
Created September 10, 2015 16:05
Python file listing
import os
directory = os.getcwd()
files = os.listdir()
for file in files:
print("{} is a file in {}".format(file, directory))
# instead of:
f = open('file.txt', 'r')
text = f.read()
# try this:
text = open('file.txt', 'r').read()
# you can do it on one line with one variable!
# less to read for the human, less to remember for the computer!
@bryjbrown
bryjbrown / 4-8-2015.summary.md
Created April 8, 2015 20:38
A summary of the Wednesday@2PM Python Code Club meeting from 4/8/2015

#A summary of the Wednesday@2PM Python Code Club meeting from 4/8/2015 Session guide: Bryan Brown Note taker: Bryan Brown

##Pre-meeting questions:

  • Most of the group uses either Mac or Linux, so demos using the bash shell would work.
  • More group members are familiar with Python 2 than Python3.
  • Group is generally agnostic about MARC/PyMARC, mainly interested in Python in general.

##Python in general:

@bryjbrown
bryjbrown / easyconda.sh
Created October 3, 2014 15:06
Idiot-proof Anaconda installation script for Mac/Linux
#!/usr/bin/env bash
# Get correct installer script and config file for OS
KERNAL=$(uname)
if [ $KERNAL = "Darwin" ]; then
URL="http://repo.continuum.io/anaconda3/Anaconda3-2.1.0-MacOSX-x86_64.sh"
CONFIG=".profile"
elif [ $KERNAL = "Linux" ]; then
URL="http://repo.continuum.io/anaconda3/Anaconda3-2.1.0-Linux-x86_64.sh"
CONFIG=".bashrc"
@bryjbrown
bryjbrown / gist:9995651
Created April 5, 2014 18:05
keybase.md
### Keybase proof
I hereby claim:
* I am bryjbrown on github.
* I am bryjbrown (https://keybase.io/bryjbrown) on keybase.
* I have a public key whose fingerprint is E76F 4330 5E77 B850 2E82 AA60 971B 2407 EA0B 1451
To claim this, I am signing this object:
@bryjbrown
bryjbrown / colorize.py
Last active August 29, 2015 13:56
An example of using ANSI escape codes to colorize output for Python shell scripts.
def purple(string):
return '\033[95m' + string + '\033[0m'
def blue(string):
return '\033[94m' + string + '\033[0m'
def green(string):
return '\033[92m' + string + '\033[0m'
def yellow(string):
return '\033[93m' + string + '\033[0m'
def red(string):
return '\033[91m' + string + '\033[0m'