Skip to content

Instantly share code, notes, and snippets.

View waynegraham's full-sized avatar

Wayne Graham waynegraham

View GitHub Profile
@waynegraham
waynegraham / mailer.php
Created October 30, 2024 16:09
PHP Mailer Test
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require './vendor/autoload.php';
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__ . '/');
$dotenv->load();
@waynegraham
waynegraham / update.sh
Last active January 30, 2024 18:11
Update StopForumSpam Blocked IPs
#!/bin/bash
#
# Pull updated IPs from StopForumSpam from
# https://www.stopforumspam.com/downloads. Note that different files have
# different download limits. Generally you can download the last day hourly and
# everything else you are limited to twice daily.
#
# URL: https://github.com/waynegraham/UpdateBlockedIPs
# Author: Wayne Graham
# License: MIT
@waynegraham
waynegraham / _footer.scss
Created September 5, 2023 17:51
CLIR footer in Bootstrap
@waynegraham
waynegraham / creat_test_files.py
Created August 26, 2023 19:08
Create text files for LORA model
import os
import shutil
def create_text_file(jpeg_file):
"""Creates a text file with the same name as the given JPEG file."""
text_file_name = jpeg_file.split(".")[0] + ".txt"
text_file = open(text_file_name, "w")
text_file.write("")
text_file.close()
@waynegraham
waynegraham / README.md
Last active November 2, 2022 20:45
Update blocked IPs for StopForumSpam

Stop Forum Spam Update

  • Add a directory (e.g. mkdir /var/www/blocked_ips)
  • Run the bash script to download the suggested listed_ip_30_all (see https://www.mediawiki.org/wiki/Extension:StopForumSpam#IP_blocking)
  • Make sure LocalSettings.php points to the extracted file
  • Run /var/www/mediawiki/extensions/StopForumSpam/maintenance/updateDenyList.php to load into APCu cache
@waynegraham
waynegraham / .zshrc
Created February 10, 2022 13:59
ZSH
# If you come from bash you might have to change your $PATH.
export PATH=$HOME/bin:$HOME/.rbenv/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/wgraham/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
@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