Skip to content

Instantly share code, notes, and snippets.

View obahareth's full-sized avatar
🧉
In the Zone

Omar Bahareth obahareth

🧉
In the Zone
View GitHub Profile
@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active May 3, 2024 02:54
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.

@lazaronixon
lazaronixon / rubocop.yml
Last active October 21, 2022 17:49
Basecamp Rubocop Template
# This template is inspired on https://github.com/basecamp/audits1984/blob/master/.rubocop.yml
#
# 1 - Add dependencies to group :development, :test
# gem "rubocop", "~> 1.26", require: false
# gem "rubocop-performance", require: false
# gem "rubocop-rails", require: false
#
# 2 - Create a file .rubocop.yml and add the lines below
# inherit_from: https://gist.githubusercontent.com/lazaronixon/7815d84702f277ead5e89c9f2aa5581f/raw/rubocop.yml
#
@markshust
markshust / hosts
Last active February 12, 2021 22:20
Notion DNS servers in the event of an outage...
# Add the following records to your DNS config
## Mac: /etc/hosts
## Windows: C:\Windows\System32\drivers\etc\hosts
104.18.23.110 admin-stg.notion.so
104.18.23.110 aif.notion.so
104.18.23.110 analytics-iframe.notion.so
104.18.23.110 analytics.pgncs.notion.so
104.18.23.110 api.notion.so
104.18.23.110 api.pgncs.notion.so
104.18.23.110 dev.notion.so
@dhh
dhh / Gemfile
Created June 24, 2020 22:23
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
I was drawn to programming, science, technology and science fiction
ever since I was a little kid. I can't say it's because I wanted to
make the world a better place. Not really. I was simply drawn to it
because I was drawn to it. Writing programs was fun. Figuring out how
nature works was fascinating. Science fiction felt like a grand
adventure.
Then I started a software company and poured every ounce of energy
into it. It failed. That hurt, but that part is ok. I made a lot of
mistakes and learned from them. This experience made me much, much
@ArturT
ArturT / main.yaml
Last active November 9, 2022 06:10
GitHub Actions - how to run parallel tests in RSpec for Ruby on Rails project. See article how to run RSpec on GitHub Actions for Ruby on Rails app using parallel jobs https://docs.knapsackpro.com/2019/how-to-run-rspec-on-github-actions-for-ruby-on-rails-app-using-parallel-jobs or sign up at https://knapsackpro.com/?utm_source=github&utm_medium=…
# .github/workflows/main.yaml
name: Main
on: [push]
jobs:
test:
runs-on: ubuntu-latest
# If you need DB like PostgreSQL, Redis then define service below.
@jackblk
jackblk / squid_proxy_tutorial.md
Last active May 2, 2024 05:35
Tutorial on how to setup a squid proxy with authentication.

Note

This tutorial is for Ubuntu & Squid3. Use AWS, Google cloud, Digital Ocean or any services with Ubuntu to follow this tutorial.

Install squid & update

sudo apt-get update
sudo apt-get install squid3
sudo apt-get install apache2-utils
require 'net/http'
require 'uri'
require 'json'
require 'cgi'
def lcs(a, b)
lengths = Array.new(a.length) { Array.new(b.length, 0) }
greatest_length = 0
output = ''
a.each_char.with_index do |x, i|
require 'net/http'
require 'uri'
require 'json'
require 'cgi'
@mutex = Mutex.new
def query(query)
uri = URI.parse("https://www.amazon.de/gp/search-inside/service-data")
http = Net::HTTP.new(uri.host, uri.port)
@gagarine
gagarine / fish_install.md
Last active May 3, 2024 08:11
Install fish shell on macOS Mojave with brew

Installing Fish shell on MacOS (Intel and M1) using brew

Fish is a smart and user-friendly command line (like bash or zsh). This is how you can instal Fish on MacOS and make your default shell.

Note that you need the https://brew.sh/ package manager installed on your machine.

Install Fish

brew install fish