Skip to content

Instantly share code, notes, and snippets.

Avatar
🛳️
SHIP IT

Dan Horst danhorst

🛳️
SHIP IT
View GitHub Profile
View samizdat-shell-help.bash
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@danhorst
danhorst / organize-photos.py
Last active Jul 30, 2018 — forked from cliss/organize-photos.py
Photo management script. This script will copy photos from "~/Pictures/iPhone Incoming" into a tree the script creates, with folders representing month and years, and photo names timestamped. Completely based on the work of the amazing Dr. Drang; see here: http://www.leancrew.com/all-this/2013/10/photo-management-via-the-finder/You can see more …
View organize-photos.py
#!/usr/bin/python
import sys
import os, shutil
import subprocess
import os.path
from datetime import datetime
######################## Functions #########################
@danhorst
danhorst / .ruby-version
Last active Jul 1, 2016
Working with Locabulary
@danhorst
danhorst / Gemfile
Last active Dec 28, 2015
The Curate gem's internal test application doesn't generate quite right. I make these change two files manually after the test application is generated: `spec/internal/Gemfile`, `spec/internal/app/assets/javascripts/application.js` And re-run bundle install.
View Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
@danhorst
danhorst / Boxen project for clamav
Last active Dec 18, 2015
How to install the clamav gem on Mac OS X with boxen & homebrew installed clamav. Inspired by: https://gist.github.com/anarchivist/1724852
View Boxen project for clamav
# /opt/boxen/repo/modules/projects/manifests/your_project.pp
# Install with: boxen your_project
#
# When you're using boxen DO NOT install clamav directly with: brew install clamav
# It won't link the header files correctly.
include homebrew
class projects::your_project {
notify { 'Setting up Your Project': }
@danhorst
danhorst / A Summary
Created Apr 4, 2013
Sufia load error
View A Summary
TEMPORARY SOLUTION
`rm spec/factories/senior_thesis_factory.rb`
`bundle exec rake db:drop db:create db:migrate`
`git co -- spec/factories/senior_thesis_factory.rb`
PROBLEM
When the factory for senior thesis loads without the database table 'local_authorities' present it fails:
spec/factories/senior_thesis_factory.rb
View disadis log
# No log enteres are made by disadis if a request is made to download an item that is not viewable by the current user
# This single request is logged by disadis for a download request with a valid one-time access token
2015/11/18 09:32:25.159767 dl 10.41.57.0 GET /k6439z92c9d 39.285593ms
# These three requests are logged by disadis for ONE successful request to the downloads controller
2015/11/18 09:32:41.127054 dl 10.41.57.0 GET /k6439z92c9d 37.343704ms
2015/11/18 09:32:41.918609 dl 10.41.57.0 GET /k6439z92c9d 24.011027ms
2015/11/18 09:32:42.127155 dl 10.41.57.0 GET /k6439z92c9d 26.094414ms
@danhorst
danhorst / download_behavior.rb
Created Nov 18, 2015
Hydra::Controller::DownloadBehavior from hydra-core 6.4.2
View download_behavior.rb
module Hydra
module Controller
module DownloadBehavior
extend ActiveSupport::Concern
included do
before_filter :load_asset
before_filter :load_datastream
end
@danhorst
danhorst / microfilm.rb
Created Jun 20, 2012
Example Rails model that is indexed into Solr with Blacklight
View microfilm.rb
class Microfilm < ActiveRecord::Base
belongs_to :library
belongs_to :location
belongs_to :collection
after_save :update_solr unless ENV['DO_NOT_INDEX']
after_destroy :remove_from_solr
scope :with_shelf_mark, lambda { |*shelf_mark|
where("#{quoted_table_name}.`shelf_mark` LIKE ?", "%#{shelf_mark.flatten.first}%") unless shelf_mark.flatten.first.blank?
@danhorst
danhorst / gist:1207464
Created Sep 9, 2011
Looksee Gemspec for version 1.0.3
View gist:1207464
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = %q{looksee}
s.version = "1.0.3"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["George Ogata"]
s.date = %q{2011-09-05 00:00:00.000000000Z}
s.email = ["george.ogata@gmail.com"]
You can’t perform that action at this time.