Skip to content

Instantly share code, notes, and snippets.

@mattstein
mattstein / count.py
Last active December 29, 2023 20:04
Use TextBlob to extract the most-used adjectives from a bunch of Markdown files.
import os
import re
import glob
from textblob import TextBlob
from collections import Counter
from nltk.corpus import stopwords
# recursively find all the Markdown in a directory and smush it into a big string
def load_markdown_files(directory):
md_files = glob.glob(os.path.join(directory, '**/*.md'), recursive=True)
@mattstein
mattstein / payload-import-example.ts
Last active November 22, 2023 10:02
Payload Markdown Import Example
import payload from "payload";
import dotenv from "dotenv";
import path from "path";
import frontmatter from "frontmatter";
import fs from "fs";
import unified from "unified";
import remarkParse from "remark-parse";
import remarkGfm from "remark-gfm";
import { remarkToSlate } from "remark-slate-transformer";
import slugify from "slugify";
@mattstein
mattstein / ploi-mastodon-nginx.conf
Created February 18, 2023 01:29
Ploi nginx Config for Mastodon
# Ploi Webserver Configuration, do not remove!
include /etc/nginx/ploi/t00t.cloud/before/*;
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
upstream backend {
server 127.0.0.1:3000 fail_timeout=0;
@mattstein
mattstein / db-test.php
Last active March 28, 2023 23:01
PHP MySQL/PostgreSQL Connection Test
<?php
/**
* Database Connection Tester
* A quick-and-dirty standalone script for checking PHP’s connection to a
* MySQL (or MariaDB) or PostgreSQL database.
*
* To use, enter the settings below and run the following from your terminal:
* ```
* php -f db-test.php
<?php
namespace Deployer;
require 'recipe/common.php';
require 'recipe/rsync.php';
set('application', 'workingconcept/wrkcpt-craft');
set('repository', 'https://github.com/workingconcept/wrkcpt-craft');
$shared = [
name: Forge Deploy
on:
push:
branches:
# - master
- develop
jobs:
deploy:

Keybase proof

I hereby claim:

  • I am mattstein on github.
  • I am mattstein (https://keybase.io/mattstein) on keybase.
  • I have a public key ASDwLlks6Mvqiz48RjCBpsDYvi17-xvDTKdtJSiAnS6Bzwo

To claim this, I am signing this object:

@mattstein
mattstein / update-fathom.sh
Created December 16, 2018 05:02
Shell script for updating fathom analytics binary on Centmin Mod linux.
#!/bin/bash
CUR_VERSION="$(fathom version | cut -d' ' -f3)"
NEW_VERSION="$(curl -s https://api.github.com/repos/usefathom/fathom/releases/latest | grep tag_name | cut -d'v' -f2 | cut -d'"' -f1)"
echo "Current Version: $CUR_VERSION => New Version: $NEW_VERSION"
if [ "$NEW_VERSION" != "$CUR_VERSION" ]; then
echo "Installing version ${NEW_VERSION}..."