Skip to content

Instantly share code, notes, and snippets.

View waynegraham's full-sized avatar

Wayne Graham waynegraham

View GitHub Profile
@waynegraham
waynegraham / convert_word_to_pdf.sh
Created July 28, 2021 12:37
Convert Word to pdf
#! /bin/bash
for file in *.doc; do
textutil -convert docx "$file"
# Account for the new `x` in `docx`
pandoc -o "${file%doc}pdf" "${file}x"
done
@waynegraham
waynegraham / postdocs.rb
Created June 16, 2021 17:38
Parse postdoc URIs from sitemap
require 'nokogiri'
require 'open-uri'
sitemaps = [
'https://www.clir.org/page-sitemap1.xml',
'https://www.clir.org/page-sitemap2.xml'
]
xml = Nokogiri::XML(URI.open(sitemaps[0]))
# urls = xml.search('url')
@waynegraham
waynegraham / Gemfile
Created April 28, 2021 20:05
Check Resource Counts
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "mechanize"
gem 'progress_bar'
gem 'terminal-table'
@waynegraham
waynegraham / README.md
Last active October 29, 2021 14:05
Youtube-dl on macos

Youtube-dl is a popular commandline utility to download content from YouTube (among many other sites).

Install Youtube-dl

Open a termianl and type:

brew install youtube-dl ffmpeg
@waynegraham
waynegraham / README.md
Created November 3, 2020 11:36
List links in a GoogleDrive directory
@waynegraham
waynegraham / gist:196c44e13e3afb494d113621e0c3c1b5
Created October 13, 2020 17:08
Find large directories in linux
du -a /home | sort -n -r | head -n 5
@waynegraham
waynegraham / translate.rb
Created July 24, 2020 14:27
Arabic Translation vs Transliteration
require 'dotenv'
require 'any_ascii'
require 'aws-sdk-translate'
Dotenv.load
class String
def is_western?
count('a-zA-Z') > 0
@waynegraham
waynegraham / Gemfile
Created July 22, 2020 15:09
Spatial Test
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem 'colorize'
gem 'geo_names'
gem "geocoder"
@waynegraham
waynegraham / env.sh
Created November 13, 2019 20:15
ZSH custom env
#! /bin/zsh
# Add commonly used folders to $PATH
export PATH="$PATH:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
for bindir in $HOME/local/bin $HOME/bin; do
if [ -d $bindir ]; then
PATH=$PATH:${bindir}
fi
done
@waynegraham
waynegraham / password.sh
Last active November 13, 2019 20:14
Password generator in zsh
#! /usr/bin/env zsh
if [ -z "$1" ]
then
length=18
else
length=$1
fi
openssl rand -base64 $length