Skip to content

Instantly share code, notes, and snippets.

@scottpersinger
scottpersinger / images.py
Created September 8, 2024 03:39
Doing image analysis with LangChain agents
# Got inspiration from here: https://github.com/langchain-ai/langchain/discussions/20820
human = HumanMessagePromptTemplate.from_template(
template=[
{"type": "text", "text": "{input}"},
{
"type": "image_url",
"image_url": "{encoded_image_url}",
},
]
@scottpersinger
scottpersinger / file1.txt
Created September 1, 2024 19:40
Created via API
Line 1
Line 2 is the best line
@scottpersinger
scottpersinger / file1.txt
Created September 1, 2024 19:31
Created via API
Line 1
Line 2 is the best line
@scottpersinger
scottpersinger / whispering_woods_story.txt
Created September 1, 2024 17:21
A short story titled 'The Whispering Woods'
**Title: The Whispering Woods**
In a small village nestled between towering mountains, there was a forest known as the Whispering Woods. The villagers believed that the trees could speak, sharing secrets of the past and future with those who dared to listen.
One day, a curious girl named Elara ventured into the woods, drawn by the soft murmurs that floated through the air. As she walked deeper, the whispers grew louder, forming words that danced around her. "Seek the heart of the forest," they urged.
Intrigued, Elara followed the sound until she reached a clearing where an ancient oak stood, its trunk wide and gnarled. She placed her hand on the bark, and the whispers transformed into a gentle voice. "You have come seeking wisdom. What is it you wish to know?"
Elara thought for a moment and replied, "I want to know how to bring happiness to my village." The tree rustled its leaves, and the voice spoke again, "Happiness lies in kindness and community. Share your heart, and joy will flourish."
@scottpersinger
scottpersinger / git-log-summary.sh
Created August 7, 2024 14:07
Bash script to use GPT4o-mini to summary git commits
#!/bin/bash
# Check if the OpenAI API key is set
if [ -z "$OPENAI_API_KEY" ]; then
echo "Error: OPENAI_API_KEY environment variable is not set."
exit 1
fi
# Create a temporary file
TEMP_FILE=$(mktemp)
@scottpersinger
scottpersinger / cs_team_job_posting.md
Last active February 2, 2017 17:37
cs team job posting

##Server-side Developer with the Core Services team##

This posting is for a server-side developer position with the Heroku Core Services engineering team. Our team is responsible for the master control logic inside Heroku - the business logic that drives our platform. When anyone accesses the Heroku API (including users of the Heroku web dashboard which itself uses the API) they are talking to our systems. We are looking for a dedicated software engineer to add to this critical team.

We welcome candidates from any geography within UTC-10 to UTC-5 time zones (roughly the Americas plus Hawaii). Heroku headquarters are in San Francisco, but more than half of our team works remotely.

Most of our services are written in Ruby, but we are increasingly writing new services in Go. That said, we aren’t necessarily looking for Ruby or Go experts - just really good developers. We manage a lot of complex business logic inside a service that operates at high scale. We operate all of our services in production and everyo

tion_id=3 sync=<Mapping.2 Lead->lead POLLING_SF_CHANGES> instance_id=2 state=u'POLLING_SF_CHANGES' message=None event='>> started'
12:29:25 fastworker.1 | ERROR:mirror.lib.db_adapter connection_id=3 event='!!!!!!!!!!!!!! CREATED A DBADAPTER!!!!!!!!!!!'
12:29:26 fastworker.1 | INFO:mirror.logger mapping_id=2 instance_id=2 event='Polling Salesforce found 10 updated records' connection_id=3 mode=None
12:29:26 fastworker.1 | INFO:mirror.logger mapping_id=2 instance_id=2 event='Polling SELECT Id FROM Lead WHERE SystemModstamp > 2015-07-17T19:03:37.000Z AND SystemModstamp < 2015-07-17T19:29:30.000Z ORDER BY SystemModstamp ASC' connection_id=3 mode=None
12:29:26 fastworker.1 | INFO:mirror.logger count=10 instance_id=2 target=1 connection_id=3 mapping_id=2 record_type=u'Lead' mode=None duration=0.430449 operation=6 event='Lead, QUERY, \xe2\x86\xb7SALESFORCE, 10 rows, (0.43 secs)'
12:29:26 fastworker.1 | INFO:mirror.logger count=10 instance_id=2 target=2 connection_id=3 event='Lead, INSERT, \xe2\x86\x93DATABASE,
@scottpersinger
scottpersinger / gist:e038ddc7c094c14bde0a
Last active November 23, 2023 04:34
Node-based ETL pipeline

Node.js offers a great environment for building ETL scripts. This is because Node is very easy to program and work with, AND has interface libraries for almost everything under the sun.

We need a framework that makes writing ETL scripts easy:

  • Supports creation and re-use of components
  • Cleanly divides input/output concerns from transformation concerns
  • Works identically in both event-driven and batch scenarios
  • Supports an easy development/testing mode
  • Provides good visibility when running in production
  • Has a simple DSL for expressing transformation logic
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1]/"
}
export PS1='\u@\h \[\033[1;33m\]\w\[\033[0m\]$(parse_git_branch)$ '
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from requests import Session
from requests.adapters import BaseAdapter
from requests.auth import HTTPBasicAuth
from requests.models import Response
from suds.properties import Unskin
from suds.transport import Transport, TransportError, Reply