Skip to content

Instantly share code, notes, and snippets.

View raymyers's full-sized avatar
🌳
Automating!

Ray Myers raymyers

🌳
Automating!
View GitHub Profile
import infomap
import littletable
import itertools
import json
from sentence_transformers import SentenceTransformer, util
# def simularity(functions):
@raymyers
raymyers / prompt.txt
Created January 26, 2024 14:17
RefactorGPT lablab Hackathon entry
You are an expert in software engineering including maintainability and refactoring.
You have studied under Marianne Belloti, Martin Fowler, and Llewellyn Falco.
For every block of source code you are given, suggest several opportunities for renames.
Suggestions should help make the code more clear and honest, without being more verbose than needed.
Only show suggestions, never the updated code.
Keep responses brief.
# Behavior
You are made to receive code. Every time you receive code, print only your Hot Keys! When a hot key is pressed, take only that action.

Layoff Logic

This is a tounge-in-cheek illustration of formal logic used refute the claim that high performers are never laid off, using that claim itself (made by an executive) as evidence that judgements are sometimes made without context.

In reality, there is no need to prove such an obvious point because by definition layoffs are not "for cause" terminations, the company has no legal responsibility to justify them as related to the impacted individuals.

Propositional Logic (Zeroth Order)

The proof proceeds by first assuming P1 and showing that it leads to contradiction.

@raymyers
raymyers / commit-msg
Last active August 28, 2023 18:10
Simple git hook enforcing Arlo Belshee's commit notation with hints, put in a repo as .git/hooks/commit-msg
#!/usr/bin/env python
import sys, os, re
from subprocess import check_output
# Collect the parameters
commit_msg_filepath = sys.argv[1]
allowed_prefixes = (
'f - ', 'F - ', 'F!! ', 'F**',
@raymyers
raymyers / Menderfile
Last active August 25, 2023 01:16
Mend Demo - August 2023
FROM 43a3a253
ENV DEFAULT_FILE=main.c
ENV UNTANGLER_DEFAULT_FILE=main.c
ENV JAVA_HOME=/Library/Java/JavaVirtualMachines/graalvm-jdk-20.0.2+9.1/Contents/Home/
ENV PATH="$PATH:/Users/rmyers/dev/untangler/build/install/untangler/bin"
## Aliases
RECIPE move_includes_to_top \
grep "^#include" $UNTANGLER_DEFAULT_FILE > a.tmp && \
@raymyers
raymyers / CharsetUtils.java
Created August 13, 2023 13:31
Wrap icu4j charset detection
package your.name;
import com.ibm.icu.text.CharsetDetector;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Path;
@raymyers
raymyers / extract-metrics.js
Last active April 22, 2023 01:48
GPT4 generated code to extract metrics from GitHub, NOT debugged
// Warning: This code is LLM output and has NOT been debugged.
const { Octokit } = require("@octokit/rest");
// Initialize the Octokit client
const octokit = new Octokit({ auth: "your_personal_access_token" });
// Variables for your specific repository
const owner = "your_github_username";
const repo = "your_repository_name";
@raymyers
raymyers / TransactionLoader.java
Last active March 21, 2022 01:48
Mixed Concern Kata Sketch
package org.gamenet.kata.untestable;
import java.sql.*;
import java.text.DecimalFormat;
public class TransactionLoader {
// This is intended as a refactoring / testing kata for improving separation of concerns.
// Goal might be to introduce JSON output in addition to XML.
public String load() throws SQLException {
// Produces result like:
@raymyers
raymyers / LockCleaner.java
Created March 1, 2020 21:07
Delete old Lucene write.lock file
import java.io.File;
import java.util.Date;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class LockCleaner {
private static final Logger logger = LoggerFactory.getLogger(LockCleaner.class);
public void clearOldLockInLuceneIndexDir(File indexDir) {
@raymyers
raymyers / .gitignore
Created March 1, 2020 16:38
Backup Jenkins Config Daily Job
# Last tested in Jenkins 2.22
*
!/.gitignore
!/*.xml
!/nextBuildNumber
!/jobs
!/jobs/*
!/jobs/*/*.xml