Skip to content

Instantly share code, notes, and snippets.

@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active November 10, 2024 23:18
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!

Want more content like this, for free? Check out my free book, RailsAI!

Alt Text

@abatilo
abatilo / cmd.go
Created April 2, 2023 21:42
Build index and search index with OpenAI
package gogptindex
import (
"context"
_ "embed"
"encoding/json"
"fmt"
"net/http"
"os"
"os/signal"
@hopsoft
hopsoft / README.md
Last active January 14, 2024 11:58
Smart Heroku Review Apps managed by GitHub Actions

Smart Heroku Review Apps managed by GitHub Actions

This gist aims to provide a simple solution for managing Heroku Review Apps with GitHub Actions due to the security incident that continues to disrupt Heroku's GitHub integration. Watch the demo to learn more.

Demo Video

.github
├── workflows
│   ├── heroku_review_app_create.yml
def uninterruptable_operation(iteration)
puts "[INFO #{Time.now}] Start operation, iteration #{iteration}. Part " \
"one: Eg. we might long poll for messages here"
sleep(5)
puts "[INFO #{Time.now}] Operation part two. Eg. we might process " \
"messages here."
sleep(1)
@jsierles
jsierles / Dockerfile
Created May 11, 2021 20:47
Deploying Rails assets as a CI step with Docker
# syntax = docker/dockerfile:experimental
FROM node
ARG NPM_TOKEN=no
ARG APP_ENV=production
ENV AWS_DEFAULT_REGION=ams3
ARG AWS_ACCESS_KEY_ID
ARG AWS_SECRET_ACCESS_KEY
RUN pip install awscli
@uyorum
uyorum / Dockerfile
Created May 6, 2021 13:41
Dockerfile for ruby-centos7
FROM centos:7 as builder
RUN yum install -y git make gcc bzip2 openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel && \
git clone https://github.com/rbenv/ruby-build.git && \
PREFIX=/usr/local ./ruby-build/install.sh
ARG RUBY_VERSION
ENV RUBY_VERSION=${RUBY_VERSION:-2.7.3}
ENV RUBY_DIR=/usr/local/ruby-${RUBY_VERSION}
RUN /usr/local/bin/ruby-build ${RUBY_VERSION} ${RUBY_DIR}
@ChristopherA
ChristopherA / brew-bundle-brewfile-tips.md
Last active November 14, 2024 18:21
Brew Bundle Brewfile Tips

Brew Bundle Brewfile Tips

Copyright & License

Unless otherwise noted (either in this file or in a file's copyright section) the contents of this gist are Copyright ©️2020 by Christopher Allen, and are shared under spdx:Creative Commons Attribution Share Alike 4.0 International (CC-BY-SA-4.) open-source license.

Sponsor

If you more tips and advice like these, you can become a monthly patron on my GitHub Sponsor Page for as little as $5 a month; and your contributions will be multipled, as GitHub is matching the first $5,000! This gist is all about Homebrew, so if you like it you can support it by donating to them or becoming one of their Github Sponsors.

# Don't print a new line at the start of the prompt
add_newline = false
# Replace the "❯" symbol in the prompt with "➜"
[character] # The name of the module we are configuring is "character"
symbol = "➜" # The "symbol" segment is being set to "➜"
error_symbol = "✗"
use_symbol_for_status = true
# Disable the package module, hiding it from the prompt completely
@saniaky
saniaky / Readme.md
Last active October 30, 2024 15:30
Docker + nginx-proxy + let's encrypt + watchtower + fail2ban

Complete solution for websites hosting

This gist contains example of how you can configure nginx reverse-proxy with autmatic container discovery, SSL certificates generation (using Let's Encrypt) and auto updates.

Features:

  • Automatically detect new containers and reconfigure nginx reverse-proxy
  • Automatically generate/update SSL certificates for all specified containers.
  • Watch for new docker images and update them.
  • Ban bots and hackers who are trying to bruteforce your website or do anything suspicious.
@nathanpeck
nathanpeck / speed-ecs-deploy.ts
Created August 29, 2019 15:00
An AWS CDK deployment to AWS Fargte, optimized for speed
import ec2 = require('@aws-cdk/aws-ec2');
import ecs = require('@aws-cdk/aws-ecs');
import elbv2 = require('@aws-cdk/aws-elasticloadbalancingv2');
import cdk = require('@aws-cdk/core');
class PublicFargateService extends cdk.Stack {
constructor(scope: cdk.App, id: string) {
super(scope, id);
// Create VPC and Fargate Cluster