Skip to content

Instantly share code, notes, and snippets.

View discoposse's full-sized avatar
💭
Life happens. How you interpret the results is what you have control over.

Eric Wright discoposse

💭
Life happens. How you interpret the results is what you have control over.
View GitHub Profile
@codingoutloud
codingoutloud / which.ps1
Last active December 24, 2015 10:19
Implements the Unix shell 'which' command using PowerShell
<#
Implements the Unix shell 'which' command using PowerShell.
original: https://gist.github.com/codingoutloud/6782961
#>
function WhichOnes
{
if ($args.Count -eq 0)
{
# obviously use of 'which' in usage text is a hack (since it is chosen to match the alias)
@discoposse
discoposse / README.md
Created April 29, 2019 01:41 — forked from tristanm/README.md
Migrating a Rails project from MySQL to PostgreSQL

Migrating a Rails project from MySQL to PostgreSQL

This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.

No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!

I chose [pgloader][1] because it's extremely fast. YMMV.

  1. Replace mysql2 gem with pg in Gemfile.
  2. Update config/database.yml for PostgreSQL. I used [Rails' template][2] as a starting point.
@pich4ya
pich4ya / proxychains-ng_m1.txt
Created March 6, 2023 03:25
Install proxychains-ng on macOS m1/m2 arm64e natively without Rosetta 2 (2023)
# @author Pichaya Morimoto (p.morimoto@sth.sh)
Problem:
```bash
brew install proxychains-ng
proxychains4 ncat 1.2.3.4 # not working
```
There are public workarounds like https://benobi.one/posts/running_brew_on_m1_for_x86/
@alexrudall
alexrudall / #ChatGPT Streaming.md
Last active June 22, 2026 02:22
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

@yeahdongcn
yeahdongcn / blog2.md
Last active July 26, 2026 15:29
Accelerating SGLang Inference on macOS: 5× Faster with Native MLX

SGLang already runs on macOS via PyTorch's MPS (Metal Performance Shaders) backend — you can launch a server, send requests, and get responses. But performance on Apple Silicon has been underwhelming. In this post, we describe how we integrated a native MLX execution path into SGLang that delivers up to 5.3× higher throughput while using significantly less memory.

The Problem: PyTorch MPS Overhead

When SGLang runs on macOS with PyTorch MPS, every operation — matrix multiplications, attention, normalization — goes through PyTorch's MPS backend, which translates PyTorch ops into Metal Performance Shaders. This translation layer adds substantial overhead:

  1. Op dispatch overhead: Each PyTorch operation is individually dispatched to MPS, missing optimization opportunities that come from fusing operations together.
  2. Memory duplication: PyTorch loads model weights into MPS memory and allocates a large KV cache, leaving less room for actual inference workloads.
  3. No fused kernels: Op