Skip to content

Instantly share code, notes, and snippets.

View devxoul's full-sized avatar
👨‍💻
Always coding

Jeon Suyeol devxoul

👨‍💻
Always coding
View GitHub Profile

Running Gemma 4 in LM Studio 0.4.x (mlx-vlm Upgrade)

Just paste this gist link to your AI agent and ask to do.

LM Studio 0.4.x bundles older versions of mlx-vlm and mlx-lm that don't support Gemma 4. This guide upgrades both packages and removes a hardcoded block.

LM Studio MLX Engine Bundled mlx-vlm Bundled mlx-lm Gemma 4
0.4.9 1.4.0 0.4.0 0.30.8
0.4.11 1.5.0 0.4.0 0.31.2
@devxoul
devxoul / delete_lambda_function_revisions.py
Created March 29, 2023 19:38
Delete AWS Lambda function revisions in parallel
import asyncio
import subprocess
import time
from asgiref.sync import sync_to_async
async def delete_revision(function_name, revision):
cmd = f"aws lambda delete-function --function-name {function_name}:{revision}"
print(cmd)
@devxoul
devxoul / hashid_num.py
Created February 24, 2023 18:04
Find how many numbers Hashids can cover within the minimum length.
import sys
from math import ceil, floor
from hashids import Hashids
target_length = 8
hashids = Hashids(min_length=target_length)
print(f"target_length={target_length}")
@devxoul
devxoul / fastapi_camel.py
Created February 4, 2023 13:48
Camelize FastAPI path params and query params.
"""
Camelize FastAPI path params and query params.
For body params and responses, use pydantic model's alias_generator config.
"""
from fastapi import FastAPI
from fastapi.dependencies.models import Dependant
from fastapi.routing import APIRoute
from humps import camelize
@devxoul
devxoul / partial.py
Last active September 3, 2024 23:14
Pydantic Partial Model
from copy import copy
from typing import Generic, Optional, TypeVar, get_args, get_type_hints
from pydantic import BaseModel
from pydantic.errors import ConfigError
from pydantic.typing import convert_generics
T = TypeVar('T', bound=BaseModel)
const getFileFromURL = async (url: string): Promise<File> => {
const result = await fetch(url)
const buffer = await result.arrayBuffer()
const blob = new Blob([buffer])
const file = new File([blob], url.split('/')[1])
return file
}
// Usage
const someFile: File
- node_modules/metro/src/node-haste/DependencyGraph/assets/empty-module.js
+ ../MyApp/node_modules/metro/src/node-haste/DependencyGraph/assets/empty-module.js
_getFileData(file) {
const relativePath = fastPath.relative(this._rootDir, file);
+ if (file.endsWith('node_modules/metro/src/node-haste/DependencyGraph/assets/empty-module.js')) {
+ console.log('rootDir:', this._rootDir);
+ console.log('file:', file);
+ console.log('relativePath:', relativePath);
+ }
return this._files.get(relativePath);
}
@devxoul
devxoul / ApolloMockedProviderDynamicVariables.tsx
Last active February 23, 2021 09:11
Use expect matcher in Apollo MockedProvider variables
jest.mock('@wry/equality', () => ({
equal: (lhs: any, rhs: any) => {
const equals = require('expect/build/jasmineUtils').equals(lhs, rhs)
return equals || jest.requireActual('@wry/equality').equal(lhs, rhs)
}
}))
const mocks = [
{
@devxoul
devxoul / Spy.ts
Created February 12, 2021 12:24
Jest Spy type
type Spy<T extends {}, M extends jest.FunctionPropertyNames<Required<T>>> = Required<T>[M] extends (...args: any[]) => any
? jest.SpyInstance<ReturnType<Required<T>[M]>, jest.ArgsType<Required<T>[M]>>
: never;