This gist accompanies a workshop titled "How to instrument your Rails app with OpenTelemetry" that was held at RailsConf 2025 in Philadelphia on July 9, 2025.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Api::ApplicationController < ActionController::API | |
include Pagy::Backend | |
include PagyCollectionSerializer::ControllerMixin | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Chatgpt::PlainChatgptClient | |
def self.chat(parameters) | |
@client ||= generate_client | |
res = @client.post("/v1/chat/completions") do |req| | |
if parameters[:stream].is_a?(Proc) | |
req.options.on_data = to_json_stream(user_proc: parameters[:stream]) | |
parameters[:stream] = true | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
#Credit: Original idea and script disable.sh by pwnsdx https://gist.github.com/pwnsdx/d87b034c4c0210b988040ad2f85a68d3 | |
#*****Work in progress***** | |
#Disabling unwanted services on macOS 11 Big Sur | |
#Modifications written in /private/var/db/com.apple.xpc.launchd/ disabled.plist, disabled.501.plist & disabled.205.plist | |
#Disabling SIP might not be required, still testing. | |
sudo mkdir mnt | |
sudo mount -o nobrowse -t apfs /dev/disk1s5 mnt/ |
- Rails 7.0.2
- stimulus js
- importmaps
- dropzone.js
- direct upload ActiveStorage
This is simple implementation of technologies in hobby project of mine built in Rails7 where I need direct upload to S3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
sudo hdiutil create -o /tmp/Monterey -size 16g -volname Monterey -layout SPUD -fs HFS+J | |
sudo hdiutil attach /tmp/Monterey.dmg -noverify -mountpoint /Volumes/Monterey | |
sudo /Applications/Install\ macOS\ Monterey.app/Contents/Resources/createinstallmedia --volume /Volumes/Monterey --nointeraction | |
hdiutil eject -force /Volumes/Install\ macOS\ Monterey | |
hdiutil convert /tmp/Monterey.dmg -format UDTO -o ~/Downloads/Monterey | |
mv -v ~/Downloads/Monterey.cdr ~/Downloads/Monterey.iso | |
sudo rm -fv /tmp/Monterey.dmg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ruby:3.0-alpine | |
RUN apk add --no-cache --update \ | |
ack \ | |
bash \ | |
build-base \ | |
curl \ | |
git \ | |
htop \ | |
less \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# iPhone with home button | |
xcrun simctl status_bar booted clear | |
xcrun simctl status_bar booted override \ | |
--time "9:41 AM" \ | |
--wifiBars 3 --cellularBars 4 --operatorName "" | |
xcrun simctl spawn booted defaults write com.apple.springboard SBShowBatteryPercentage 1 | |
# iPhone X | |
xcrun simctl status_bar booted clear | |
xcrun simctl status_bar booted override --time "9:41" --wifiBars 3 --cellularBars 4 |
A dump of the SwiftUI.framework binary for the iOS simulator (as of Xcode 12.0 beta 2) using the swift-reflection-dump tool.
Note: I used a Swift 5.3 compiler build from a few weeks ago that I had laying around. Because of ABI stability, I don't think the swift-reflection-dump version has to match the compiler version that was used to build the binary, but I'm not 100% sure.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
brew install certbot | |
# change <my.domain> to preferred domain | |
certbot certonly --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory --manual-public-ip-logging-ok -d '*.<my.domain>' -d <my.domain> | |
# add certificates to heroku | |
heroku certs:add -a eduqai-prod /etc/letsencrypt/live/<my.domain>/fullchain.pem /etc/letsencrypt/live/<my.domain>/privkey.pem | |
# may need to run with sudo |
NewerOlder