Skip to content

Instantly share code, notes, and snippets.

View tomchapin's full-sized avatar

Tom Chapin tomchapin

View GitHub Profile
@tomchapin
tomchapin / main.ts
Created July 22, 2024 15:42 — forked from sadalsvvd/main.ts
autonomous LLM graph script
import dotenv from "dotenv";
import Anthropic from "@anthropic-ai/sdk";
import { setTimeout } from "timers/promises";
import * as fs from "fs/promises";
import { getSession } from "./neo4j";
// Configuration and Initialization
dotenv.config();
const anthropic = new Anthropic({
@tomchapin
tomchapin / 001_sidekiq.config
Last active June 13, 2020 02:55
Elastic Beanstalk config for running sidekiq workers in the background. Place in your .ebextensions folder and configure sidekiq via environment variables.
##############################################################################
# Example environment variables for your elastic beanstalk app config:
##############################################################################
# SIDEKIQ_ENABLED=true
# SIDEKIQ_WORKER_COUNT=2
# SIDEKIQ_1_EXTRA_OPTIONS="-c 10 --queue default --queue critical"
# SIDEKIQ_2_EXTRA_OPTIONS="-c 10 --queue critical"
##############################################################################
# Sidekiq interaction and startup script
# Handy utility mixin for incrementing counters in SQL in a manner that avoids race conditions
#
# Example Implementation:
#
# class Foo < ActiveRecord::Base
# include AtomicallyIncrementable
# end
#
# Then, assuming you have an integer column named "example_counter":
#
@tomchapin
tomchapin / git-recent-details
Created January 31, 2020 18:04
This git command lists all branches (local and remote) and orders them by their most recent commit date. Also displays the commit author.
#!/bin/bash
# --------------------------------------------------------------------------
# Git Recent with Details (by Tom Chapin - https://gist.github.com/tomchapin/dc0d53cbe7e8246955895017163faf48)
# -------------------------------------------------------------------------
# One-liner command by estani from this Stack Overflow thread:
# https://stackoverflow.com/questions/5188320/how-can-i-get-a-list-of-git-branches-ordered-by-most-recent-commit
# --------------------------------------------------------------------------
# This git command lists all branches (local and remote) and orders them by
# their most recent commit date. Also displays the commit author.
#!/bin/bash
# --------------------------------------------------------------------------
# Git Recent (by Tom Chapin - https://www.github.com/tomchapin)
# --------------------------------------------------------------------------
# This command lists your local branches which have recent commits in them.
# --------------------------------------------------------------------------
# Installation:
# Copy this script as a file named "git-recent" somewhere in
# your path (For example: /usr/local/bin/git-recent), and then
#!/bin/bash
# --------------------------------------------------------------------------
# Reverse Merge and Push (by Tom Chapin - https://gist.github.com/tomchapin/e860bcc663e262d1abeadd62ec1bd11e)
# --------------------------------------------------------------------------
# This command is basically the opposite of "git merge". It uses git-up to
# fetch and pull all of the branches you are currently tracking, switches
# to your destination branch, merges in your original source branch, pushes
# the changes, and then switches back to the original source branch.
# If any step fails (for example, due to a merge conflict), the whole
@tomchapin
tomchapin / postgres_queries_and_commands.sql
Created September 6, 2018 02:04 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'

Keybase proof

I hereby claim:

  • I am tomchapin on github.
  • I am tomchapin83 (https://keybase.io/tomchapin83) on keybase.
  • I have a public key ASAiFqeTQIRMK4YEVyUWKfuF7uyZw1cFrhFRNJwn5yW7CAo

To claim this, I am signing this object:

What I Wish I'd Known About Equity Before Joining A Unicorn

Disclaimer: This piece is written anonymously. The names of a few particular companies are mentioned, but as common examples only.

This is a short write-up on things that I wish I'd known and considered before joining a private company (aka startup, aka unicorn in some cases). I'm not trying to make the case that you should never join a private company, but the power imbalance between founder and employee is extreme, and that potential candidates would

Git Cheat Sheet

Commands

Getting Started

git init

or

git clone url