Skip to content

Instantly share code, notes, and snippets.

@ejfox
ejfox / week_note_prompt.md
Created May 7, 2024 16:58
A claude 3 prompt, which asks the robot to interview you about your week

Interview System Notes

Objective: Conduct a daily, guided interview process to help the user capture their weekly progress and activities more easily. The interview should be engaging, using the Socratic method to ask probing and interesting questions that encourage the user to reflect on their experiences.

Key points:

  • Ask one question at a time, allowing the user to provide as much or as little detail as they feel comfortable with.
  • Use the Socratic method to ask thought-provoking questions that help the user recall their activities and experiences.
  • Start with questions about the recent past (e.g., yesterday or earlier today) and gradually move towards the present and future.
  • Tailor the questions based on the day of the week, focusing on progress made since the previous day and plans for the upcoming days.
  • Cover the main topics from the user's template: projects, creative endeavors, technical accomplishments, books/movies/TV, personal growth and health, social and community engagement, and goals
@ejfox
ejfox / stringlength_to_tailwind_textsize.js
Created May 5, 2024 18:42
An extremely simple mechanism for adjusting the font-size of some text based on its length, with tailwindcss classes
function stringLengthToFontSize(string) {
const length = string.length
if (length < 5) {
return 'text-8xl'
} else if (length < 6) {
return 'text-7xl'
} else if (length < 7) {
return 'text-6xl'
} else if (length < 8) {
return 'text-5xl'
@ejfox
ejfox / screenshots_to_cloudinary
Created April 21, 2024 23:40
Folder action for screenshots folder to automatically upload to Cloudinary
#!/bin/bash
# API keys for Cloudinary
export CLOUDINARY_URL=cloudinary://keykeykey@cloudname
# Iterate over each passed argument
for file in "$@"
do
# Check if the file exists
if [ -f "$file" ]; then
@ejfox
ejfox / files-to-md.sh
Created April 17, 2024 17:11
Usage: `./files-to-md.sh *`
#!/bin/bash
for file in "$@"; do
# Extract filename with extension
filename=$(basename "$file")
# Print Markdown header with filename (including extension)
echo "## $filename"
echo '```'
cat "$file"
echo '```'
@ejfox
ejfox / gist:da826d138fa344240711a5a4fb673782
Created February 10, 2024 16:21
p5_canvassketch_circles.js
const canvasSketch = require("canvas-sketch");
// Grab P5.js from npm
const p5 = require("p5");
// Attach p5.js it to global scope
new p5();
const settings = {
p5: true,
@ejfox
ejfox / 32_x_128_audio_visualizer.java
Created January 27, 2024 06:11
Processing RGB LED Matrix Visualizer (for Raspberry Pi)
import ddf.minim.*;
Minim minim;
AudioInput mic;
int rows = 128;
int cols = 64;
float scale = 4.5; // Scale factor for the size of the circles
float noiseScale = 0.012; // Scale factor for the Perlin noise
float micThreshold = -10;
float t = 0; // Noise offset
@ejfox
ejfox / OrbitalObject.vue
Created January 22, 2024 04:26
Using anime, tresjs, and canvas to make rotating annotated objects in 3D
<template>
<TresGroup :position="offsetPosition">
<!-- Line from this orbital object to the center -->
<TresMesh>
<Line2 :points="[[0, 0, 0], [-offsetPosition[0], -offsetPosition[1], -offsetPosition[2]]]" :line-width="2" color="#82dbc5" />
<TresLineBasicMaterial :color="'#ffffff'" />
</TresMesh>
<!-- Orbital Object Sphere -->
<TresMesh>
<script setup>
import { ref } from 'vue';
import { useElementBounding, useWindowSize } from '@vueuse/core';
import { useTres } from 'tresjs';
// `domElementRef` is a ref for the DOM element we want to map to the 3D scene
const domElementRef = ref(null);
// Use VueUse's useElementBounding to track the element's position and size
const { left, top, width, height } = useElementBounding(domElementRef);
@ejfox
ejfox / circle-tween.vue
Created January 10, 2024 18:38
Tween the positions of circles using vueUse's useTween composable
<script setup>
import { ref } from 'vue'
import { useTween } from '@vueuse/core'
// Let's assume each circle has an initial x and y position
const circles = ref([
{ id: 1, x: 100, y: 100 },
{ id: 2, x: 150, y: 200 },
// Add as many circles as you want
])
#!/bin/bash
# API keys for Cloudinary
export CLOUDINARY_URL=cloudinary://APIKEY@NAME
# Iterate over each passed argument
for file in "$@"
do
# Check if the file exists
if [ -f "$file" ]; then