Skip to content

Instantly share code, notes, and snippets.

View aantix's full-sized avatar

Jim Jones aantix

View GitHub Profile
@aantix
aantix / 2_ollama.rb
Last active April 2, 2024 12:46
Easy LLM setup for Ruby on Rails application
class Ollama
URL = 'http://localhost:11434/api/chat'
def initialize
@uri = URI.parse(URL)
end
def prompt(question)
response = Net::HTTP.start(@uri.hostname, @uri.port, use_ssl: @uri.scheme == 'https') do |http|
http.post(@uri, JSON.dump({
@aantix
aantix / mp4_to_gif.sh
Created May 5, 2023 14:20
Convert mp4 video to optimized gif
#!/bin/bash
# https://www.bannerbear.com/blog/how-to-make-a-gif-from-a-video-using-ffmpeg/
# Mac OSX
# brew install ffmpeg
# brew install gifsicle
echo "Extracting the palette."
ffmpeg -i $1 -filter_complex "[0:v] palettegen" palette.png
module Y
def hello(str)
puts "prepended before super"
super(str)
puts "prepended after super"
end
end
class X
def hello(str)
@aantix
aantix / rails_all_app_model_modules_classes.rb
Last active September 24, 2022 16:10
Getting all Rails application level classes and modules
Zeitwerk::Loader.eager_load_all && true
objs = []
ObjectSpace.each_object(Module){|ob| objs << [ob, ((Object.const_source_location(ob.to_s) rescue nil) || (Module.const_source_location(ob.to_s) rescue nil))]}
objs.reject!{|o| !(o&.last&.first =~ /#{Rails.root.to_s}/)}
objs = objs.collect{|c| c.flatten.first}
objs
Donald D Freeman Tech Infrastructure Coordinator 115757.00
Lea Ann Johnson Grant Coordinator 105913.00
Kristi L Peters Training/support Coordinator 102089.00
Darin W Raguse Technology Services Coordinator 101417.00
Kimberly K Samuelson Coordinator 97810.33
Tonya L Jolley Coordinator 95847.20
Jill L Bird Coordinator 95321.12
Barbara A Fitzgerald Coordinator 93240.12
Laura A Runge Coordinator 92616.63
Jane L Bozek Coordinator 89934.04
@aantix
aantix / the-mad-chatter.txt
Last active April 19, 2019 15:31
Documentation for The Mad Chatter - A Novell Network based chat system. 95-96.
T H E
€€€ª €€€ª €€€€€ª €€€€€€ª
€€€€ª €€€€∫ €€…ÕÕ€€ª €€…ÕÕ€€ª
€€…€€€€…€€∫ €€€€€€€∫ €€∫ €€∫
€€∫»€€…º€€∫ €€…ÕÕ€€∫ €€∫ €€∫
€€∫ »Õº €€∫ €€∫ €€∫ €€€€€€…º
»Õº »Õº »Õº »Õº »ÕÕÕÕÕº
€€€€€€ª €€ª €€ª €€€€€ª €€€€€€€€ª €€€€€€€€ª €€€€€€€ª €€€€€€ª
require 'rugged'
require 'time'
require 'active_support/all'
DATE_FORMAT = "%-m/%-d/%Y"
puts "repo = #{ARGV[0]}"
puts "branch = #{ARGV[1]}"
puts "email = #{ARGV[2]}"
puts '=========================='
@aantix
aantix / allow_webrtc_video.reg
Created May 19, 2014 14:29
Allow webrtc video policy under http for Chrome (Windows)
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\Software\Policies\Google\Chrome]
"AudioCaptureAllowed"=dword:00000001
"VideoCaptureAllowed"=dword:00000001
[HKEY_LOCAL_MACHINE\Software\Policies\Google\Chrome\AudioCaptureAllowedUrls]
"1"="http://[*.]fiveaskfive.com/"
[HKEY_LOCAL_MACHINE\Software\Policies\Google\Chrome\VideoCaptureAllowedUrls]
@aantix
aantix / zeus_rubymine.txt
Last active December 25, 2015 05:39
Running tests under Zeus for Rubymine 6.0 momiji EAP
If you want to run individual specs under Zeus & the latest Rubymine EAP
* Ensure that you install the latest Zeus
gem install zeus --version=0.13.4.pre2
* Remove the following lines from spec_helper if they exist
require 'rspec/autorun'
require 'rspec/autotest'
* Set the default to zeus for rspec
@aantix
aantix / generate_leads.sh
Created August 19, 2012 06:38
Rails : script/runner with rvm called from cron
#!/usr/bin/env bash
source /usr/local/rvm/environments/ruby-1.9.2-p318@action_traction
cd /var/www/action_traction/current
script/rails runner -e production "LeadSearch.generate_leads" 2>&1 >> /var/www/action_traction/current/log/generate_leads.log