Skip to content

Instantly share code, notes, and snippets.

@njpearman
njpearman / claude_35_artifacts_system_prompt.txt
Last active September 21, 2024 02:01
Extracted Claude 3.5 Sonnet system prompt for artifacts
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
@njpearman
njpearman / vim_journal_opener.vim
Created June 28, 2020 14:23
VimScript journal opener
" My first super-simple and hardcoded bit of VimScript
" that opens up a markdown-based journal file
function! JournalToday()
let filename = strftime("~/journal/%Y-%m-%d.markdown")
echo "Opened journal: " . filename
execute "vsplit" filename
endfunction
" executing a function is literal: enter command-line mode, enter call and the
" function name, and press return
@njpearman
njpearman / retag-with-date
Created February 11, 2020 12:56
Regenerate all tags with date set to that of the commit that was tagged
#!/bin/bash
# This script will regenerate every tag in a repository, setting the
# creation date of the tag to that of the commit that the tag is
# attached to. The message for the tag is set to the static string
# 'End of unit'.
git tag | while read tag;
do
git checkout ${tag}
@njpearman
njpearman / retag-script
Last active February 19, 2020 13:34
Reattaching tags to a rebased branch in a git repo
#!/bin/bash
# This script applies tags that have become detached from a rebased branch, assuming
# that the original message for each tag has been unchanged in the rebased branch.
# This is necessary because tags get bound to a commit hash and a rebase will alter
# the commit hashes on a branch, "detaching" any tags that have been attached. It is
# of course debatable whether tags _should_ be moved around at all, but I needed to
# do this for a particular repo I have been working on. It has also been a good
# opportunity for me to explore git and some command line tools. It is not meant to
# be a reference script and there will almost certainly be much more effective ways
#!/bin/bash
echo "Starting $@"
nohup "./$@" &> /dev/null &
def create_lambda
lambda {|i| puts "You're at #{i}" }
end
my_lam = create_lambda
[1,2,3].each &my_lam
my_thing.instance_eval { (class << self; self; end).instance_eval "include MyModule" }