Skip to content

Instantly share code, notes, and snippets.

@hectorcorrea
hectorcorrea / file-compare.rb
Created October 23, 2024 14:46
Compare list of files in Globus with list of files in PDC Describe
require "json"
doi = ARGV[0]
if doi == nil
puts "Must provide a DOI"
return
end
# List of files from Globus
# fetch via https://github.com/pulibrary/rdss-handbook/blob/main/globus_cli.md#a-complete-example
# DESCRIPTION:
#
# Returns a list of files (assets) for a given path.
#
# This script uses iterators to handle cases where there are many files
# in the given path. Therefore the first time you call it you give it a
# `path` and the script will give you back an interator. Call the script
# again with the `iterator` to start iterating over the list of files.
#
# Call it as many times until the return includes `iterated complete="true"`
@hectorcorrea
hectorcorrea / demo.html
Last active March 21, 2024 14:56
JavaScript DOM events and call back functions
<html>
<head>
<!-- what does this code do? -->
<script src="leequery.js"></script>
</head>
<body>
<h1>Playing with JavaScript</h1>
<p>
This is a paragraph with a button:
@hectorcorrea
hectorcorrea / fuse-demo.html
Created January 12, 2024 01:37
Demo how to use fuse.js with plain JavaScript
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/fuse.js/dist/fuse.js"></script>
</head>
<body>
<input type="text" id="searchTerms" placeholder="text to search" />
<button id="searchButton">Search</button>
<div id="searchResults">
# =======================================================================
# tagAdd - adds a tag (term) to the dictionary
#
# Usage:
#
# script.execute :in file:/Users/correah/src/mediaflux/tagAdd.tcl :arg -name tagName "tagXX" :arg -name tagDescription "this is the tag XX"
#
# =======================================================================
set log_name "homework-2023-03-24"
@hectorcorrea
hectorcorrea / pre-commit
Created August 11, 2022 15:03
A sample Git pre-commit hook to make sure file vault.yml file is encrypted before accepting a commit
#!/bin/sh
# reference: https://www.atlassian.com/git/tutorials/git-hooks
#
# To use this Git hook in a given repository:
# 1. copy the content to .git/hooks/
# 2. make it an executable: chmod u+x .git/hooks/pre-commit
#
# Once installed, everytime you issue `git commit` it will make sure the file vault.yml has the
# expected token to indicate that is encrypted. If the token is not found we assume the file is
# NOT encrypted and reject the commit.
@hectorcorrea
hectorcorrea / results.html
Created November 30, 2020 15:47
Sample results.html for SolrDora using hard-coded fields. Allows to easily set the display order.
{{ define "content" }}
<style>
em {
background: #e9e91966;
}
</style>
<div class="row">
<div class="col-md-4">
<form action="/search" method="GET">
<input type="text" id="q" name="q" value="{{ .Q }}" placeholder="enter text" autofocus/>
@hectorcorrea
hectorcorrea / one.html
Created November 17, 2020 16:48
Sample one.html for SolrDora using hard-coded fields. Allows to easily set the display order.
{{ define "content" }}
<style>
/* https://stackoverflow.com/a/22955585/446681 */
.input-group{
width: 100%;
}
.input-group-addon{
width: 15%;
text-align: left;
}
@hectorcorrea
hectorcorrea / passenger_report.rb
Last active September 4, 2018 13:41
Creates a tab delimited list from the passenger status log file.
# Parses a file with the output of `passenger-status` and outputs a
# tab delimited list with the date and number of requests in queue
# that `passenger-status` reported.
#
# The file `passenger_status.log` is created with via a cron job that
# runs every X minutes as follows:
#
# /path/to/.gem/gems/passenger-5.1.12/bin/passenger-status >> ./logs/passenger_status.log
#
#