Skip to content

Instantly share code, notes, and snippets.

View jamesrf's full-sized avatar

James Fournie jamesrf

  • Vancouver Community College
  • Vancouver
View GitHub Profile
import pymarc
import csv
marcfile = "evergreen-full-latest.mrc"
circ_modifiers = ['laptop','tablet','library-equipment']
with open(marcfile, 'rb') as data, open('output.csv','w', newline='') as csvfile:
reader = pymarc.MARCReader(data)
@jamesrf
jamesrf / update-exchange-rates.pl
Last active April 19, 2019 19:20
Updates exchange rates in Evergreen
#!/usr/bin/perl
# ---------------------------------------------------------------
# Copyright (C) 2019 James Fournie
# James Fournie <jfournie@vcc.ca>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
#People counting
https://docs.google.com/presentation/d/19myVJQS8D__Ge1VOfd3wzmdl7RtP4A3TyYQkqTiu_Z4/edit?usp=sharing
#Luigi
https://docs.google.com/presentation/d/1lrIGTTYNY5ODHDRjEqvZACpqk5px697fkrPqWC9QO34/edit?usp=sharing
SELECT distinct field_content, count(*) FROM sierra_View.varfield
where
marc_tag LIKE '65%' and (
(field_content ILIKE '%rehab%' OR field_content ILIKE '%therapy%') OR
field_content ILIKE '%occupational ther%' OR
field_content ILIKE '%physical ther%' OR
field_content ILIKE '%mental health' OR
field_content ILIKE '%nervous system' OR
field_content ILIKE '%neurological%' OR
field_content ILIKE '%orthopedic%' OR
@jamesrf
jamesrf / conifer_ldap_sync.py
Created September 21, 2018 21:34
Conifer's Evergreen LDAP Sync
#!/usr/bin/env python
# Copyright (C) 2011 Laurentian University
# Dan Scott <dscott@laurentian.ca>
#
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
@jamesrf
jamesrf / fix-mac.sh
Last active July 18, 2018 18:23
Fix apple workstations
# disable "lock screen" option from apple menu
sudo defaults write /Library/Preferences/com.apple.loginwindow DisableScreenLockImmediate -bool true
# auto logout after 30 mins
sudo defaults write /Library/Preferences/.GlobalPreferences.plist com.apple.autologout.AutoLogOutDelay -int 1800
# disable multiple sessions
sudo defaults write /Library/Preferences/.GlobalPreferences MultipleSessionEnabled -bool false
!function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}var r=n(1),i=o(r),a=n(4),u=o(a),s=n(39),l=o(s);l["default"].render(u["default"].createElement(i["default"],null),document.getElementById("example"))},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Ob
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
kato node list | awk '{print $1}' | xargs -i{} ssh stackato@{} kato op upstream_proxy set http://10.0.0.47:8080
#!/bin/sh
export PGPASSWORD=$(kato config get cloud_controller_ng db/database/password)
export PGHOST=$(kato config get cloud_controller_ng db/database/host)
export PGUSER=$(kato config get cloud_controller_ng db/database/user)
export PGDATABASE=$(kato config get cloud_controller_ng db/database/database)
for i in $(find /home/stackato/stackato/data/cc-droplets -type f); do
file=$(basename $i)
# appname=$(psql -t -A -c "select a.name from apps a join droplets b on (a.droplet_hash = b.droplet_hash) where a.guid = '$file'")
appname=$(psql -t -A -c "select a.name from apps a join droplets b on (a.droplet_hash = b.droplet_hash) where a.droplet_hash = '$file'")