Skip to content

Instantly share code, notes, and snippets.

@gciampa
gciampa / claude-aws
Created March 17, 2026 16:40
Launch claude with aws bedrock
claude-aws() {
local cache_file="/tmp/bedrock_models_cache"
local cache_ttl=86400
local selected_model_id
local selected_profile
local current_time=$(date +%s)
# 1. Select AWS Profile via fzf FIRST
# We need this now so it can be used for the cache refresh if needed
selected_profile=$(aws-vault list --profiles | fzf --height 20% --border --header "Select AWS Profile")
@gciampa
gciampa / index.html
Created April 2, 2023 18:22
Tailwind animations with Stimulus
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<script type="module">
import { Application, Controller } from "https://unpkg.com/@hotwired/stimulus/dist/stimulus.js"
import { enter, leave, toggle } from "https://unpkg.com/el-transition@0.0.7/index.js"
window.Stimulus = Application.start()
@gciampa
gciampa / git-setup.sh
Created November 23, 2011 19:55
Git setup niceties
# via https://gist.github.com/419201#file_gitconfig.bash
# Install (from Matt's gist) these useful Git aliases & configurations with the following command:
# $ bash <(curl -s https://raw.github.com/gist/419201/gitconfig.bash)
git config --global color.ui auto # colorize output (Git 1.5.5 or later)
git config --global color.interactive auto # and from 1.5.4 onwards, this will works:
echo "Set your name & email to be added to your commits."
echo -n "Please enter your name: "
require 'rubygems'
require 'json'
require 'redis'
class RedisComments
def initialize(redis,namespace,sort_proc=nil)
@r = redis
@namespace = namespace
@sort_proc = sort_proc
end
@gciampa
gciampa / index.html
Created February 17, 2011 04:20
jQuery Toggle Menu
<html>
<head>
<style type="text/css">
.nested {
display: none;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
user app;
worker_processes 2;
error_log /home/app/logs/nginx.error.log info;
events {
worker_connections 1024;
}
require 'sequel'
# Database
#
# A helper class to wrap calls to Sequel Database, primarily for getting a database from a YAML config
# file and for migrating.
class Database
@@configuration_file = File.join( File.dirname(__FILE__), "../config/database.yml" )
raise Exception.new("No '#{@@configuration_file}' file was found. ") if @@configuration_file.nil?
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
# - a browser with WebSocket support
#
# Usage:
# ruby redis_pubsub_demo.rb
#
get '/hello/:name' do |name|
"#{params.inspect}"
end
jQuery.slowEach = function(array, interval, callback) {
if(!array.length) return;
var i = 0;
next();
function next() {
if(callback.call(array[i], i, array[i]) !== false)
if(++i < array.length)
setTimeout(next, interval);
}