Skip to content

Instantly share code, notes, and snippets.

@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active April 17, 2024 01:12
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!

How to add ChatGPT streaming to your Ruby on Rails 7 app!

This guide will walk you through adding a ChatGPT-like messaging stream to your Ruby on Rails 7 app using ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind. All code included below!

Alt Text

First, add the ruby-openai gem! Needs to be at least version 4. Add Sidekiq too.

@gretel
gretel / httpd.conf
Last active December 4, 2022 07:29
"openbinge" put relayd and varnishd in front of some (ob)httpd serving mp4 files to get a html-less video streaming endpoint (pf -> relayd -> varnish -> obhttpd -> file)
# $OpenBSD: httpd.conf,v 1.20 2018/06/13 15:08:24 reyk Exp $
chroot "/zfs/videos"
logdir "/var/log"
server "*" {
listen on 10.0.100.20 port 8442
tcp nodelay
tcp sack
tcp socket buffer 65536
@trey
trey / README.md
Last active February 18, 2023 23:13
Cheat Sheet: J Dilla

I love this playlist so much and I would be sad if it went away. Now I’ll have the track names in any case.

27 hours and 3 minutes of shuffle-friendly goodness.

Howto

  1. In Spotify: select all tracks, copy, then paste them into a text file.
  2. Run shell script (which uses my url script).

Shell script:

@font-face {
font-family: SegoeUI;
src:
local("Segoe UI Light"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff2) format("woff2"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.woff) format("woff"),
url(//c.s-microsoft.com/static/fonts/segoe-ui/west-european/light/latest.ttf) format("truetype");
font-weight: 100;
}
@henrik
henrik / amazon_referralizer.rb
Created July 5, 2010 18:26
Ruby class to add your Amazon Associates referral id to an Amazon URL, replacing any that were already there. See http://github.com/henrik/delishlist.com/blob/master/lib/amazon_referralizer.rb for the latest version.
# Amazon::Referralizer
# by Henrik Nyh <http://henrik.nyh.se> 2010-07-05 under the MIT license.
# Add your Amazon Associates referral id to an Amazon URL, replacing any that were already there.
#
# E.g.:
#
# Amazon::Referralizer.referralize("http://amazon.co.uk/o/ASIN/B00168PO6U/evil-20", "good-20")
# # => "http://amazon.co.uk/o/ASIN/B00168PO6U/good-20"
#