Skip to content

Instantly share code, notes, and snippets.

View yatli's full-sized avatar
🔊
↑↑↓↓←→←→abab

Yatao Li yatli

🔊
↑↑↓↓←→←→abab
View GitHub Profile
@xlphs
xlphs / MyIOContext.cpp
Last active June 24, 2022 18:12
MyIOContext
#include <cstdio>
#include <string>
class MyIOContext {
public:
std::string datafile;
AVIOContext *ioCtx;
uint8_t *buffer; // internal buffer for ffmpeg
int bufferSize;
FILE *fh;
@JonCole
JonCole / ThreadPool.md
Last active March 6, 2024 05:03
Intro to CLR ThreadPool Growth

ThreadPool Growth: Some Important Details

The CLR ThreadPool has two types of threads - "Worker" and "I/O Completion Port" (aka IOCP) threads.

  • Worker threads are used when for things like processing Task.Run(…) or ThreadPool.QueueUserWorkItem(…) methods. These threads are also used by various components in the CLR when work needs to happen on a background thread.
  • IOCP threads are used when asynchronous IO happens (e.g. reading from the network).

The thread pool provides new worker threads or I/O completion threads on demand (without any throttling) until it reaches the "Minimum" setting for each type of thread. By default, the minimum number of threads is set to the number of processors on a system.

Once the number of existing (busy) threads hits the "minimum" number of threads, the ThreadPool will throttle the rate at which is injects new threads to one thread per 500 milliseconds. This means that if your system gets a burst of work needing an IOCP thread, it will proces

@Justsoos
Justsoos / douyu_new.py
Last active June 2, 2021 02:46
斗鱼2019新api,直播流URL提取,请看最下评论地址
#! /usr/bin/env python3
import re
import requests
import argparse
import time
import hashlib
import json
import logging
from requests.adapters import HTTPAdapter
{-# language DeriveFunctor #-}
import Data.Functor.Fixedpoint
data E r =
Block [r] |
Define String (DefExpr r)
deriving (Functor, Show)
data DefExpr r =
Function [String] r
deriving (Functor, Show)
@bogdan-kulynych
bogdan-kulynych / install-cuda-10-bionic.sh
Last active December 5, 2023 10:26
Install CUDA 10 on Ubuntu 18.04
# WARNING: These steps seem to not work anymore!
#!/bin/bash
# Purge existign CUDA first
sudo apt --purge remove "cublas*" "cuda*"
sudo apt --purge remove "nvidia*"
# Install CUDA Toolkit 10
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/cuda-repo-ubuntu1804_10.0.130-1_amd64.deb
@knightsc
knightsc / hijack.c
Created February 26, 2019 21:20
Example of how to hijack a thread on macOS to run code in a remote process
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <unistd.h>
#include <mach/mach.h>
#include <mach/mach_vm.h>
#include <dlfcn.h>
#include <objc/runtime.h>
@akemin-dayo
akemin-dayo / qemu-screamer-build-usage-guide.md
Last active June 11, 2024 13:28
A guide to building and using the audio-enabled "Screamer" fork of PowerPC QEMU on macOS and Windows

A guide to building and using the audio-enabled "Screamer" fork of PowerPC QEMU on macOS and Windows

Karen/あけみ (Twitter, Homepage)

Last updated: 2021/10/09 (QEMU-screamer version 6.1.50)

Here's a quickly-written guide describing how to build and use mcayland's excellent "Screamer" fork of QEMU which adds working audio support to QEMU for PowerPC guests!

Yes, this means working audio in PowerPC versions of OS X, Mac OS 9, and even Linux!

This guide isn't… quite up to my quality standards yet, but I figured I'd release it in this state regardless for anyone that might benefit from it, especially since I had to figure out quite a bit of this myself due to some of the existing documentation being somewhat outdated or incorrect.