星期四, 十一月 12, 2015
Mac 转发 PS4 twitch 直播流量到第三方直播平台
Mac 设置
I. enable IP Forwarding
1. 开机启用
新建或编辑 /etc/sysctl.conf 文件
加入内容:
net.inet.ip.forwarding=1
加入内容:
net.inet.ip.forwarding=1
2. 现在启用
$ sudo sysctl -w net.inet.ip.forwarding=1
$ sudo sysctl -w net.inet.ip.forwarding=1
II. set Traffic Redirection (Port Forwarding)
编辑 pf 配置文件
编辑 /etc/pf.conf 文件[^1]
在 rdr-anchor 下面新增一行
rdr-anchor "ps4"
在 load anchor 下面新增一行
load anchor "ps4" from "/etc/pf.anchors/ps4"
新建 /etc/pf.anchors/ps4 文件[^1]
内容:
rdr pass on en0 inet proto tcp from any to 199.9.0.0/16 port 1935 -> 127.0.0.1 port 1935
[^1] 文件需要以空行结尾
在 rdr-anchor 下面新增一行
rdr-anchor "ps4"
load anchor "ps4" from "/etc/pf.anchors/ps4"
内容:
rdr pass on en0 inet proto tcp from any to 199.9.0.0/16 port 1935 -> 127.0.0.1 port 1935
启用 pf 规则
1. 现在启用
# 重新加载 pf 规则
$ sudo pfctl -f /etc/pf.conf
# 启用 pf
$ sudo pfctl -e
# 重新加载 pf 规则
$ sudo pfctl -f /etc/pf.conf
# 启用 pf
$ sudo pfctl -e
2. 开机启用
编辑 /System/Library/LaunchDaemons/com.apple.pfctl.plist 文件
在 pfctl 下面加入一行
<string>-e</string>
在 pfctl 下面加入一行
<string>-e</string>
III. set nginx rtmp server
安装 nginx
# http://brew.sh/homebrew-nginx/
$ brew tap homebrew/nginx
$ brew install nginx-full --with-rtmp-module
# http://brew.sh/homebrew-nginx/
$ brew tap homebrew/nginx
$ brew install nginx-full --with-rtmp-module
配置 nginx
编辑 /usr/local/etc/nginx/nginx.conf 文件
与 http 同级,加入
rtmp {
server {
listen 1935;
chunk_size 131072;
max_message 256M;
application app {
live on;
record off;
meta copy;
push rtmp://直播地址;
}
}
}
与 http 同级,加入
rtmp {
server {
listen 1935;
chunk_size 131072;
max_message 256M;
application app {
live on;
record off;
meta copy;
push rtmp://直播地址;
}
}
}
开启 nginx
# Start process:
$ sudo nginx
# Reload config:
$ sudo nginx -s reload
# Stop process:
$ sudo nginx -s stop
# Start process:
$ sudo nginx
# Reload config:
$ sudo nginx -s reload
# Stop process:
$ sudo nginx -s stop
PS4 设置
网关设为 Mac 的 ip 地址
星期二, 一月 20, 2015
[root]一条命令开启 Google Now & 位置报告
星期六, 四月 05, 2014
在 windows 上使用 Dvorak 键盘布局
第一种:修改输入法
1、英文输入法
美国英语-DVORAK2、中文输入法
KBDDV.DLL,然后注销电脑第二种:修改键盘映射
qwerty.reg,留着备用。Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"ScanCode Map"=hex:00,00,00,00,00,00,00,00,01,00,00,00,00,00,00,00
dvorak.reg 文件,双击导入注册表,注销后生效。Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"ScanCode Map"=hex:00,00,00,00,00,00,00,00,22,00,00,00,2d,00,30,00,24,00,2e,00,\
11,00,33,00,33,00,11,00,12,00,20,00,34,00,12,00,1b,00,0d,00,0d,00,1b,00,16,\
00,21,00,17,00,22,00,20,00,23,00,1a,00,0c,00,2e,00,17,00,23,00,24,00,14,00,\
25,00,31,00,26,00,35,00,1a,00,30,00,31,00,13,00,18,00,26,00,19,00,2f,00,34,\
00,28,00,10,00,0c,00,28,00,19,00,13,00,18,00,1f,00,1f,00,27,00,2c,00,35,00,\
15,00,14,00,22,00,16,00,25,00,2f,00,10,00,2d,00,21,00,15,00,27,00,2c,00,00,\
00,00,00
星期日, 九月 29, 2013
[tasker]使用 VPN 而无需使用 PIN 或图案解锁的方法(VPN without PIN)
需要神器 Secure Settings
-
[Secure Settings] Enable Device admin (Settings—> Security—> Device Administrators—> check "Secure Settings").
-
设置一个 VPN (目的为启用存储凭据),设置 PIN 为 0000
-
[Tasker]添加任务,命名为 "boot"
-
(+) → 任务 → 等待 → 设为 30 秒
-
(+) → 插件 → Secure Settings → 编辑 → Password/PIN → Enabled , 选择 "Pin Code",输入Pin 和 Confirm Pin (步骤2设置的PIN)
-
(+) → 任务 → 等待 → 设为 5 秒(确保上一个任务已经完成)
-
(+) → 插件 → Secure Settings → 编辑 → Password/PIN → Disabled.
!别忘了保存
-
-
[Tasker]添加配置文件
(+) → 事件 → 系统 → 设备已启动
选择任务“boot”
-
重启手机运行 boot 任务
重要
-
设备需要约1-2分钟来解密您保存的凭据,在这段时间内,试图访问VPN设置或保存的密码将呈现一个密码对话框。只要取消该对话框,并多等待一会即可。
-
等待时间缩短也没什么问题
[tasker]set DNS 教程
@pOHVII 我设两个,一个state选网络移动网络,一个是网络wifi已连接,感觉一个也够,一个进入任务,一个退出任务。任务那儿选脚本->执行外壳->setprop net.dns1 8.8.8.8,再添加一个setprop net.dns2 8.8.4.4,选中使用root
— 果子狸 (@jim4ever) September 21, 2013
星期二, 九月 03, 2013
What's installed in my Nexus 4?
Recovery
clockworkmod, 使用 ROM Manager 可以方便的更新 recovery (需 root 权限)
ROOT 管理
PS: Root 后可安装神器 BusyBox
权限管理
-
PDroid Manager 完爆各类权限管理软件, 不占用后台 (需要配合补丁使用, 用 The Auto-Patcher 可以方便的生成补丁)
文件管理
防火墙
自启管理
图标替换
Unicon[注 1] 可以替换图标而不需要使用第三方桌面
虚拟按键替换
软件个性化
App Settings[注 1] 可以设置每个软件的分辨率、语言、横竖屏模式、全屏模式等
内核
-
Faux123 Kernel 支持 OTG, 支持 Touch Control
-
ziddey-otg rebase to Franco支持 OTG
内核管理
Faux123 Kernel Enhancement Pro
音效管理
FauxSound Audio/Sound Control 内核级, 减少杂音
手势加强
Touch Control (Nexus 4)可以实现手势锁屏以及滑动解锁,需要内核支持
短信拦截
来去电归属地
翻墙
-
Shadowsocks 耗流量少, 缺点: YouTube 速度缓慢
-
fqrouter2 流量混淆可直连观看 YouTube (非常流畅), 缺点: 耗流量大
-
Set DNS 辅助翻墙, 主动分配 DNS (也可用 tasker 实现)
无线同步
BitTorrent® Sync 局域网之间同步,数据不在云端保留,数据传输经过加密亮度调节
Brightness 可以把亮度调的比最暗还暗
自动化
Tasker 配合 Secure Settings 可以控制飞行模式,还可以在用 VPN 的同时使用滑动解锁 (参见 XDA 或者我的另一篇博文)
备注
- ^ 需要安装 Xposed 外挂模块
星期六, 十一月 10, 2012
[C++]直接插入排序
//
// D_InsertSort.cpp
// Sort
//
// Created by pOH7 on 12-11-10.
// Copyright (c) 2012年 pOH7. All rights reserved.
//
//直接插入排序
#include <iostream>
using namespace std;
#define ElemType int
#define MAXSIZE 20
class SqList
{
public:
SqList(ElemType *t, int length)
{
this->length = length;
for (int i = 1; i <= length; ++i)
{
r[i] = t[i - 1];
}
}
void D_InsertSort();
void display();
private:
ElemType r[MAXSIZE + 1];//r[0]作哨兵
int length;
};
void SqList::D_InsertSort()
{
int i, j;
for (i = 2; i <= length; ++i)
{
r[0] = r[i];//r[0] = r[j + 1]
for (j = i - 1; r[0] < r[j]; --j) r[j + 1] = r[j];
r[j + 1] = r[0];//将r[j + 1]插入有序区r[1..j]
}
}
void SqList::display()
{
//cout << "length = " << length << endl;
for (int i = 1; i <= length; ++i)
{
cout << r[i] << " ";
}
cout << endl;
}
int main()
{
ElemType t[] = {2, 4, 6, 8, 7, 1, 4, 1, 5};
int length = sizeof(t) / sizeof(*t);
SqList L(t, length);
L.display();
L.D_InsertSort();
L.display();
return 0;
}


