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
obahareth / #ChatGPT
Created May 13, 2023 22:43 — forked from alexrudall/#ChatGPT
ChatGPT streaming with ruby-openai, Rails 7, Hotwire, Turbostream, Sidekiq and Tailwind!
View #ChatGPT

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.

obahareth / Gemfile
Created August 28, 2022 09:06 — forked from czj/Gemfile
Outputting Rails app logs to via logstash
View Gemfile
gem "lograge"
gem "logstash-event"
gem "logstash-logger"
obahareth / main.yaml
Created August 24, 2022 13:00 — forked from ArturT/main.yaml
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 or sign up at…
View main.yaml
# .github/workflows/main.yaml
name: Main
on: [push]
runs-on: ubuntu-latest
# If you need DB like PostgreSQL, Redis then define service below.
obahareth /
Created August 15, 2022 10:37 — forked from jackblk/
Tutorial on how to setup a squid proxy with authentication.


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
obahareth /
Created August 15, 2022 06:31 — forked from drmalex07/
Wrap a docker container in a systemd service. #docker #systemd.service #systemd #cgroups


Suppose we want to wrap a container running a Redis instance as a service.

Override unit file for docker daemon

We must override the service unit file that ships with docker (under /lib/systemd/system) in order to pass some cgroup-related options to the docker daemon. So, following the usual method to override parts of a unit file, we create the file /etc/systemd/system/docker.service.d/10-service.conf with contents:

obahareth / Gemfile
Created July 5, 2020 10:58 — forked from dhh/Gemfile
HEY's Gemfile
View 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
obahareth / hyperpayPayments.js
Created December 19, 2019 16:39 — forked from saikatharryc/hyperpayPayments.js
Hyperpay integration
View hyperpayPayments.js
const saveCardToHyperPay = data => {
var path = "/v1/registrations";
let cardBrand = Payment.fns.cardType(data.number);
if (cardBrand == "visa" || cardBrand == "master" || cardBrand == "mada") {
var cardData = querystring.stringify({
"authentication.userId": config.HYPERPAY.UserId,
"authentication.password": config.HYPERPAY.Password,
"authentication.entityId": config.HYPERPAY.EntityId,
paymentBrand: cardBrand.toUpperCase(),
"card.number": data.number || "",
obahareth /
Created December 25, 2018 10:55 — forked from a7madgamal/
Dark mode for Slack on MacOS
  1. Close slack
  2. Open this file /Applications/
  3. Append this to it
document.addEventListener('DOMContentLoaded', function() {
   url: '',
   success: function(css) {
obahareth / Gemfile
Created January 26, 2017 21:05 — forked from goncalvesjoao/Gemfile
Changes you need to make in order to make Devise use JWT Header Authentication
View Gemfile
# Add the "" gem to your "Gemfile"
gem 'jwt'
obahareth / 0_reuse_code.js
Created August 29, 2014 07:36
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console