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
@aeons
aeons / config.exs
Last active July 24, 2024 12:43
Erlang 27 :json module in Phoenix
config :phoenix, :json_library, ErlJson
@Shpigford
Shpigford / .cursorrules
Last active July 22, 2024 19:59
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 May 15, 2024 16:18
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 April 25, 2024 00:14
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;
@tvaliasek
tvaliasek / main.js
Created June 5, 2018 20:09
electron axios stream download with progress
import {ipcMain} from 'electron'
const fs = require('fs')
const axios = require('axios')
/* ... */
ipcMain.on('downloadFile', function (event, data) {
const filePath = data.filePath
const item = data.item
@kkm
kkm / index.html
Created April 15, 2018 22:14
Chrome MediaRecorder in H264
<!DOCTYPE html>
<head>
<script>
var recordedChunks = [];
var constraints = {
audio: true,
video: true
};
var mediaRecorder = null;