Skip to content

Instantly share code, notes, and snippets.

View matthewlenz's full-sized avatar

Matthew Lenz matthewlenz

  • 06:18 (UTC -05:00)
View GitHub Profile
@matthewlenz
matthewlenz / autocategorization.py
Created August 7, 2023 14:22
Richard Gruss - Text Classification With Python
# Note: This will probably require some tweaking. Dr. Gruss sent this to me but said he hasn't used it in a very long time.
# Video link: https://www.youtube.com/watch?v=EfEW3_RLnGA
import os
import random
import string
from nltk import word_tokenize
from collections import defaultdict
from nltk import FreqDist
from nltk.corpus import stopwords
@matthewlenz
matthewlenz / tmp_ssh.sh
Last active August 7, 2023 14:07
Temporarily add SSH access for your current IP to your Google Cloud Compute instances.
#!/bin/bash
## If you've locked down all your ports for a project but need to access your instances via ssh (google cloud shell maybe?)
## this script might be of use to you.
EXPIRE=$(date +%s --date='now + 8 hours')
case "$1" in
add)
test -e ~/.tmp-ssh && echo "Rule exists, remove it first" && exit 1