Skip to content

Instantly share code, notes, and snippets.

View azyobuzin's full-sized avatar

Takuya Sakurai azyobuzin

View GitHub Profile
ffmpeg -f gdigrab -framerate 6 -i desktop -vcodec h264 -g 30 -pix_fmt yuv420p -s 640x360 -profile:v main -crf 28 -f hls -hls_time 5 -hls_list_size 0 -hls_flags '+append_list' out.m3u8
private unsafe Task Write(void* ptr, int size)
{
var p = (byte*)ptr;
var buf = new byte[size];
for (var i = 0; i < buf.Length; i++)
buf[i] = p[i];
return this._stream.WriteAsync(buf, 0, size);
}
use std::ffi;
use std::fmt;
use std::mem;
use std::os::windows::prelude::*;
use kernel32;
use winapi::*;
use super::WindowsError;
pub struct ProcessInfo {
entry: PROCESSENTRY32W
pub fn open_process(process_id: u32) -> Result<Option<ProcessHandle>, WindowsError> {
let handle = unsafe {
kernel32::OpenProcess(
PROCESS_TERMINATE | SYNCHRONIZE,
FALSE,
process_id as DWORD
)
};
if handle.is_null() {
using System;
using System.Runtime.InteropServices;
class Program
{
static void Main(string[] args)
{
GetStdHandle(-11);
}
@azyobuzin
azyobuzin / Dockerfile
Last active November 19, 2020 04:20
Wine 上で Mono を動かすやつ
FROM ubuntu:17.04
# apt-get update がクソ遅いので日本サーバーに変更
RUN sed -i 's|//archive\.ubuntu\.com|//jp\.archive\.ubuntu\.com|g' /etc/apt/sources.list
RUN dpkg --add-architecture i386 && \
apt-get update -y && \
apt-get install -y wget apt-transport-https software-properties-common && \
wget -O - https://dl.winehq.org/wine-builds/Release.key | apt-key add - && \
apt-add-repository -y https://dl.winehq.org/wine-builds/ubuntu/ && \
@azyobuzin
azyobuzin / BytesToIntBenchmark-report-github.md
Created August 11, 2017 16:27
int と byte 配列の変換ベンチマーク
BenchmarkDotNet=v0.10.9, OS=Windows 10.0.16257
Processor=Intel Core i7-3770 CPU 3.40GHz (Ivy Bridge), ProcessorCount=8
Frequency=3312785 Hz, Resolution=301.8608 ns, Timer=TSC
  [Host]     : .NET Framework 4.7 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.2542.1
  DefaultJob : .NET Framework 4.7 (CLR 4.0.30319.42000), 64bit RyuJIT-v4.7.2542.1

using System;
using System.Runtime.InteropServices;
namespace ConsoleApp2.WindowsApi
{
public abstract class DCHandle : SafeHandle
{
public DCHandle(bool ownsHandle)
: base(IntPtr.Zero, ownsHandle)
{ }
Unhandled exception: unimplemented function KERNEL32.dll.AddDllDirectory called in 32-bit code (0x7bc52ef9).
Register dump:
CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
EIP:7bc52ef9 ESP:003bf2a8 EBP:003bf31c EFLAGS:00000212( - -- I -A- - )
EAX:00587ace EBX:7bcdd000 ECX:003bf310 EDX:7ebb129a
ESI:003bf2c0 EDI:00422298
Stack dump:
0x003bf2a8: 003bf2d0 0042dea8 7bc52ed3 0042dea8
0x003bf2b8: 003bf2e8 7ebb12d7 80000100 00000001
0x003bf2c8: 00000000 7bc52ef9 00000002 00587b0a
public struct BitmapInfoHeader
{
public int Width;
public int Height;
public ushort Planes;
public ushort BitCount;
public BitmapCompression Compression;
public uint SizeImage;
public int XPelsPerMeter;
public int YPelsPerMeter;