Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block cfitz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
cfitz / default
Created Mar 21, 2019
INCF ElasticSearch NGINX configuration
View default
server {
listen 443;
server_name localhost;
ssl_certificate /etc/ssl/certs/STAR_incf_org-chained.crt;
ssl_certificate_key /etc/ssl/private/STAR_incf_org.key;
ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
from Crypto.PublicKey import RSA
from Crypto.Cipher import PKCS1_v1_5 as Cipher_PKCS1_v1_5
from base64 import b64decode
# uses pycryptodome (3.7.2)
file_in = open('private.pem','rb').read()
key = RSA.import_key(file_in) # import the public key
# we make our cipher
cipher =
View fix_sort_names.rb
# plugins/local/backend/model/fix_sort_names.rb
[ NameCorporateEntity, NameFamily, NamePerson, NameSoftware].each do |klass|
$stderr.puts "Updating ... #{klass}"
klass.all.each do |obj|
# get the jsonmodel
cfitz /
Created Oct 31, 2017 — forked from JamesMGreene/
A comparison of using `git flow` commands versus raw `git` commands.


gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

cfitz / login_test.rb
Last active Sep 22, 2017
example integration test using rack-cas, capybara, and minitest
View login_test.rb
# to do integration tests with rack-cas, you have to use the FakeCas middleware, which intercepts CAS redirects and
# displays a "fake CAS" login form. This form will give a token to anything, but it has to be a user that's in the
# DB for the application to log the user in.
# To set this up, add
# config/environments/test.rb :
# config.rack_cas.fake_attributes = { 'admin': { "admin": true, "cas_directory_id": "admin", "name": "admin" } }
# test/test_helper.rb:
# require 'capybara/rails'
cfitz / http.rb
Created May 17, 2017
Use HTTPS if post is set to 443/8443
View http.rb
require 'net/http'
class Net::HTTP
singleton_class.send(:alias_method, :start_orig, :start)
class << self
def start(address, *arg, &block)
opt = Hash.try_convert(arg[-1]) ? arg.pop : {}
opt[:use_ssl] = ( [ 443, 8443 ].include?(arg.first) )
arg << opt
View index.html.erb
<%# This would go into views/welcome/index.html.erb %>
<%= setup_context :title => "Home", :suppress_breadcrumb => true %>
<div class="row">
<div class="col-md-12">
<%= render_aspace_partial :partial => "shared/flash_messages" %>
<div class="col-md-12" style="padding: 30px;">
<h1><%= I18n.t "welcome.heading" %></h1>
cfitz / american-communists.xml
Created Jan 12, 2017
Add a note with 856$u and 856$z ( <a href="$u">$z</a> )
View american-communists.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<collection xsi:schemaLocation="" xmlns="" xmlns:xsi="">
<leader>00000npc a2200000 u 4500</leader>
<controlfield tag="008">081112i19002007xx eng d</controlfield>
<datafield tag="040" ind2=" " ind1=" ">
<subfield code="a">NyNyUA</subfield>
<subfield code="b">eng</subfield>
<subfield code="c">NyNyUA</subfield>
<subfield code="e">dacs</subfield>
View plugin_init.rb
# plugins/local/public/plugin_init.rb
Rails.application.config.after_initialize do
SearchController.class_eval do
def set_search_criteria
@criteria ={|k,v|
View manifestor.rb
require 'uri'
require 'fileutils'
require 'iiif/presentation'
require 'json'
collection = nil
@base = ""
You can’t perform that action at this time.