Skip to content

Instantly share code, notes, and snippets.

@whunter
whunter / checksums.js
Created October 11, 2022 17:24
Calculate checksums for files in local directory in JS
// Remember there are file size limits in V8
for (const file of files) {
reader = new FileReader();
totalBytes += file.size;
totalFiles++;
reader.onload = event => {
filesRead++;
const binary = event.target.result;
try {
@whunter
whunter / squash.sh
Last active July 22, 2021 14:03
Squash your commits super easily
#!/bin/bash
# Add a "squash" alias that calls this file and then you can squash your commits by running "squash master" (or whichever branch you want to rebase against)
base_branch=$1
if [[ -n "$base_branch" ]]; then
current_branch=`git branch --show-current`;
echo "Squashing $current_branch";
commits=`git log $base_branch..$current_branch --oneline | wc -l | xargs`;
echo "$commits commits";
import boto3
from boto3.dynamodb.conditions import Key, Attr
import json
import os
# Environment variables
region_name = "us-east-1"
collection_table_name = "Collection-gbunibuh3vhgpnbianmozt7oam-colmap"
import boto3
from boto3.dynamodb.conditions import Key, Attr
import json
import os
# Environment variables
region_name = "us-east-1"
collection_table_name = "Collection-tc5r2gm3yjddnfs4dl4vblcari-colmap"
collectionmap_table_name = "Collectionmap-tc5r2gm3yjddnfs4dl4vblcari-colmap"
import boto3
import json
import os
# Environment variables
region_name = "us-east-1"
test_table = "Collection-cg5wa4as3fgkdpyrghj5g2z2jq-leestest"
source_table_name = test_table
target_table_name = test_table
http://geoblacklight.dld.lib.vt.edu:8983/solr/development/update?stream.body=%3Cdelete%3E%3Cquery%3E%2A%3A%2A%3C%2Fquery%3E%3C%2Fdelete%3E&commit=true
sudo apt-get install python-setuptools
sudo easy_install pip
sudo pip install youtube-dl
youtube-dl -F <id>
youtube-dl --restrict-filenames -f <format> <id>
require 'net/ldap'
email = ARGV[0]
ldap = Net::LDAP.new(host: 'directory.vt.edu')
ldap.bind
treebase = 'ou=People,dc=vt,dc=edu'
ldap_attributes = {display_name: :displayname, department: :department}
filter = Net::LDAP::Filter.eq('mail', email)
#!/bin/bash
echo "Upgrading ansible installation"
brew upgrade ansible
echo ""
echo ""
echo "Copying ldap_search.rb from gist.github.com"
curl -L https://gist.githubusercontent.com/whunter/02bc567781b7e3d4c9928b330e8b26b5/raw/43d8ae290b165dd2d98754b51c5c0faac0ab4543/ldap_query.rb > ./ldap_query.rb
Showing /var/local/hydra/data_science_hyrax/vendor/bundle/ruby/2.3.0/gems/hyrax-2.1.0.beta1/app/views/hyrax/dashboard/show_admin.html.erb where line #62 raised:
RSolr::Error::Http - 400 Bad Request
Error: {"responseHeader":{"status":400,"QTime":4,"params":{"q":"() AND (system_create_dtsi:[2018-01-17T00:00:00Z TO 2018-01-24T00:00:00Z])","qt":"standard","rows":"0","wt":"json"}},"error":{"metadata":["error-class","org.apache.solr.common.SolrException","root-error-class","org.apache.solr.parser.ParseException"],"msg":"org.apache.solr.search.SyntaxError: Cannot parse '() AND (system_create_dtsi:[2018-01-17T00:00:00Z TO 2018-01-24T00:00:00Z])': Encountered \" \")\" \") \"\" at line 1, column 1.\nWas expecting one of:\n <NOT> ...\n \"+\" ...\n \"-\" ...\n <BAREOPER> ...\n \"(\" ...\n \"*\" ...\n <QUOTED> ...\n <TERM> ...\n <PREFIXTERM> ...\n <WILDTERM> ...\n <REGEXPTERM> ...\n \"[\" ...\n \"{\" ...\n <LPARAMS> ...\n \"filter(\" ...\n <NUMBER> ...\n <TERM> ...\n