Skip to content

Instantly share code, notes, and snippets.

View hainuo's full-sized avatar
🏠
Working from home

hainuo hainuo

🏠
Working from home
View GitHub Profile
#!/usr/bin/env pwsh
# https://stackoverflow.com/questions/8761888/capturing-standard-out-and-error-with-start-process
function Start-Command ([String]$Path, [String]$Arguments) {
$pinfo = New-Object System.Diagnostics.ProcessStartInfo
$pinfo.FileName = $Path
$pinfo.RedirectStandardError = $true
$pinfo.RedirectStandardOutput = $true
$pinfo.UseShellExecute = $false
$pinfo.Arguments = $Arguments
@hainuo
hainuo / reactphp_push_server.php
Last active December 27, 2018 17:09
基于 reactphp 的 tcp 服务消息推送
<?php
/**
* 感谢强大的 reactphp 。
* 使用 reactphp 创建的可以限制连接数量的消息服务器
* 1. 可以群发消息
* 2. 可以客户端单对单发消息
* 3. 可以服务器对单个客户端发送消息
* usage by `composer require react/socket:^1.1`
**/
require_once __DIR__ . '/vendor/autoload.php';