Skip to content

Instantly share code, notes, and snippets.

@whunter
whunter / save.sh
Last active April 10, 2025 14:09
Shell script for saving stuff to github
usage="Usage: . ./save.sh < filename | all | -n string | -b string>"
if [ -z "$1" ]; then
echo $usage
return
fi
savedDir='/path/to/your/git-repo'
randos="$savedDir/randos"
notes="$savedDir/notes.txt"
bookmarks="$savedDir/bookmarks.txt"
workingDir=$(pwd)
@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