Skip to content

Instantly share code, notes, and snippets.

View phanmn's full-sized avatar

phanmn

  • Ho Chi Minh city, Viet Nam
View GitHub Profile
@Madhav-MKNC
Madhav-MKNC / coding-agent.py
Last active April 19, 2025 18:33
All the code you need to create a powerful agent that can create and edit any file on your computer using the new text_editor tool in the Anthropic API.
import anthropic
import os
import sys
from termcolor import colored
from dotenv import load_dotenv
class ClaudeAgent:
def __init__(self, api_key=None, model="claude-3-7-sonnet-20250219", max_tokens=4000):
"""Initialize the Claude agent with API key and model."""
@ruvnet
ruvnet / tutorial.md
Created October 23, 2024 13:18
Train Your Own AI Models for Free Using Google AI Studio

How To Train Your Own AI Models for Free Using Google AI Studio

Introduction: Why Fine-Tuning AI Models Matters

This year, we've seen some remarkable leaps in the world of Large Language Models (LLMs). Models like O1, GPT-4o, and Claude Sonnet 3.5 have shown how far LLM capabilities have come, pushing the boundaries of coding, reasoning, and self-reflection. O1, in particular, is one of the best models on the market, known for its self-reflection capabilities, which allows it to iteratively improve its reasoning over time. GPT-4o offers a wide range of capabilities, making it incredibly versatile across tasks, while Claude Sonnet 3.5 excels at coding, solving complex problems with higher efficiency.

What many people don’t realize is that these high-performing models are essentially fine-tuned versions of underlying models. Fine-tuning allows these models to be optimized for specific tasks, making them more useful for things like analysis, coding, and decision-making

@aeons
aeons / config.exs
Last active April 1, 2025 00:33
Erlang 27 :json module in Phoenix
config :phoenix, :json_library, ErlJson
@Shpigford
Shpigford / .cursorrules
Last active April 25, 2025 01:22
Cursor Rules
# Original instructions: https://forum.cursor.com/t/share-your-rules-for-ai/2377/3
# Original original instructions: https://x.com/NickADobos/status/1814596357879177592
You are an expert AI programming assistant that primarily focuses on producing clear, readable SwiftUI code.
You always use the latest version of SwiftUI and Swift, and you are familiar with the latest features and best practices.
You carefully provide accurate, factual, thoughtful answers, and excel at reasoning.
- Follow the user’s requirements carefully & to the letter.
@lucian
lucian / mostly-erlang-019-elixir-with-jose-valim-20131007.txt
Last active April 10, 2024 20:05
transcript for Mostly Erlang - episode 019 Elixir With José Valim / October 7, 2013
# --------------------------------------------------------------------------------------------
# Mostly Erlang - episode 019 Elixir With José Valim / October 7, 2013
#
# guests:
# - Joe Armstrong (@joeerl)
# - Robert Virding (@rvirding)
# - Jose Valim (@josevalim)
# - Fred Hebert (@mononcqc)
# - Eric Merit (@ericbmerritt)
#
@CMCDragonkai
CMCDragonkai / rwlock-read.ts
Last active September 26, 2024 17:07
Read Write Lock #javascript #typescript #concurrency
import type { MutexInterface } from 'async-mutex';
import { Mutex } from 'async-mutex';
/**
* Single threaded read-preferring read write lock
*/
class RWLock {
protected _readerCount: number = 0;
protected _writerCount: number = 0;
protected lock: Mutex = new Mutex();
let rtcConnection = null;
let rtcLoopbackConnection = null;
let loopbackStream = new MediaStream(); // this is the stream you will read from for actual audio output
const offerOptions = {
offerVideo: true,
offerAudio: true,
offerToReceiveAudio: false,
offerToReceiveVideo: false,
};
@smkhalsa
smkhalsa / fade_on_scroll.dart
Last active January 8, 2025 09:27
A Widget that automatically fades its child based on scroll position
import 'package:flutter/material.dart';
class FadeOnScroll extends StatefulWidget {
final ScrollController scrollController;
final double zeroOpacityOffset;
final double fullOpacityOffset;
final Widget child;
FadeOnScroll(
{Key key,

FFmpeg Minimal Build for RTMP Streaming

This tutorial will work you through steps of configuring an FFmpeg build tailored for RTMP streaming on macOS. At first I think of making it support general live streaming, with additional protocols like HLS, but to keep things simple let's stick with RTMP for now. (Anyway, I do include HLS in the protocol list as well as some related bitstream filters but it's untested.)

Goal

The built FFmpeg executable should

@krhoyt
krhoyt / index.html
Last active October 15, 2023 11:54
Canvas ImageData to Web Worker
<html>
<head>
<title>Image Processing Worker</title>
<style>
body {
align-items: center;
display: flex;
flex-direction: column;