ntzyz's space

∠( ᐛ 」∠)_

Category

  • Linux
  • Web
  • Network
  • Algorithm
  • Other
  • Photos
  • Gameplay

Tags

  • Linux
  • JavaScript
  • PS4
  • A6300
  • HTML5
  • OpenWrt
  • A7M3
  • FE55
  • Web
  • 雪
  • Tunnel
  • VPN
  • node
  • 狗
  • AudioContext
  • Network
  • iptables
  • systemd
  • PowerShell
  • SVP
  • WireGuard
  • HTML
  • Algorithm
  • HDOJ
  • Arch Linux
  • NVMe
  • MediaSource
  • PPTP
  • 手办
  • LeetCode
  • Minecraft
  • Routing
  • SDL
  • CSharp
  • FromSoftware
  • SQLite
  • UglifyJS
  • MHW
  • Highlight.js
  • PHP
  • Surface
  • WebAssembly
  • MPV
  • iSCSI
  • Highcharts.js
  • CAPCOM
  • GitHub
  • UEFI
  • IPv6
  • NAT
  • Gaming
  • MySQL
  • Node
  • CI
  • Sekiro
  • USB

Recent replies

  • 青手烈酿 发表于「PS4 网络优化」
  • xzdry 发表于「尝试使用 Github Actions」
  • LazyWolfLin 发表于「PS4 网络优化」
  • Aurora 发表于「Wonder Festival 2019 上海国际手办模型展」
  • ntzyz 发表于「小实验:扩展 PS4 的存储」
  • ntzyz 发表于「电子垃圾列表」
  • kiracca 发表于「电子垃圾列表」

Links

About me
WordPress 存档

ZephRay
>Lithia's Core
Project Aurora
Ferrets 家的 Wordpress
spinmry实验室
Yuno's Wonderland
notonokodds
春上冰月的博客
kasora's blog
徐靖峰 | 个人博客
Test2g
447f.Misaka
Project RC
Shell Bin

Linux 下双屏多 DPI 的一种思路

2019 年 4 月 15 日分类:Linux#Linux

很简单(粗暴),只要全部按照最高 DPI 去渲染,然后在低分辨率上压缩后呈现就行了。这种方案下低 DPI 的屏幕会被“超采样”,会有一点点模糊,但是比起让高分屏呈现低分辨率画面的方案,损失不算大。

具体怎么做的话,比如我这里是两个 27 寸的显示器,分别接驳在 DP1 和 HDMI2 上(可以使用 xrandr 查看)。其中,DP1 是一块 Dell 的 2K 显示器(2560x1440),HDMI 2 是联想的一个 FHD 显示器(1920x1080)。屏幕的位置关系的话,FHD 在左侧,2K 在右侧。

首先你需要禁用窗口管理器自带的多屏幕管理器(比如 KDE 有 Kscreen2),如果没有那就不用管了。之后,在 ~/.xinitrc ,或其他等效的 X11 启动脚本中,中添加以下命令:

xrandr \
  --output HDMI2 \
    --panning 2400x1350 \ # 左侧屏幕的渲染分辨率
    --pos 0x0 \           # 左侧屏幕左上角的位置
    --scale 1.25x1.25 \   # 左侧屏幕的缩放倍数
  --output DP1 \
    --panning 2560x1440 \ # 右侧屏幕的渲染分辨率
    --pos 2560x0 \        # 右侧屏幕左上角的位置
  --fb 4960x1440          # 整个 framebuffer 的大小

这里的一些数值都是我这里的参数,不同的多显示器配置可能需要稍微自己算一下,没啥难度的。

完成后,重启 Xorg 即可完成调整,不出意外两块屏幕就能比较正常的工作了。效果如下图:

MORE

个人网络配置方案

2019 年 3 月 15 日分类:Network#Linux#PS4#Tunnel#Network

距离上一篇文章发布已经好几个月了,自己的网络搭建也和之前有了比较大的区别,就简单的记录一下吧。

基础网络访问

首先是居住场所对 Internet 的访问。大概是去年十月吧,我从之前住的那个只有无线接入网络的小地方搬出来,开始和同事一起合租。花的钱和之前差不多,但是体验上提升了不止一个档次,最明显的一点是对路由器和无线接入点有了完全的控制能力。这间出租房已经准备好了电信的 100Mbps 宽带,然而却配了一个稀烂的无线路由器,并且是由光猫进行 PPPoE,也就是上网过程中出现了两次 NAT,强迫症表示十分不满。

第一步就是解决掉原配的无线路由器,换上了自己在大二时购买的网件 R6250。同时着手光猫的破解,准备将其由路由模式改为桥接模式。光猫的处理上没有遇到什么困难,掀开弱电箱看一下光猫型号并 Google,就顺利地找到了可用的相关教程。然后掏出同事的 x86 路由器,灌入来自 OpenWrt x86_64 18.06.1,并配置好 PPPoE 接口,就顺利的完成了路由改桥接的工作。至于 R6250 呢,则将它配置成接入点(AP)模式,并将 WAN 口与路由器的 LAN 口连接即可。

除此以外,我还购买了迅雷的快鸟会员,该服务可以将 100Mbps 的宽带提升到 200Mbps 下行,20Mbps 上行的水平,体验进一步飞升。

MORE

Temporary workaround for Windows 10 network connection sharing failure after reboot

2018 年 9 月 9 日分类:Other#PowerShell

The house I rented in Shanghai only provides wireless network (802.11n) to access the Internet, but I personally hope that I can get a faster wireless intranet and hide my network device from the outside, so I purchased a NETGEAR A6210 wireless network card featuring 802.11AC support and USB 3.0 interface, ready to make such a network connection:

+--------------------+       +-----------------------+
| LAN(802.11AC + GbE)| CAT5E |  HP ProLiant MS Gen8  |
| (PS4, Kindle, etc) +-------+  eth0: 192.168.137.1  |
|  192.168.137.0/24  |       | wlan0: 192.168.0.x/24 |
+--------------------+       +---+-------------------+
                                 | 802.11n
                             +---+------------+
                             | TP-LINK Router |
                             +----------------+

Implenemting this kind of structure is quiet simple for Linux PCs. You only need to enable ip_forward and execute iptables -t nat -A POSTROUTING -j MASQUERADE with root privilege. But unfortunately this USB3.0 wireless NIC has no driver in the mainline kernel. The open source driver provided by MTK has very bad performance under OpenWrt. In conclusion, it seems that the only choice of operating system is Windows.

Configuring such a network for Windows is very simple too. Right-clicking on the adapter of the wireless network card. Then select the Sharing tab, check Allow other network users to connect etc. Then choose the Ethernet Network Connection option from the dropdown. However, Microsoft has buried a bug in the implementation of network sharing in Windows 10: the network sharing will be broken after restarting the computer. Shared interface still providing DHCP service, but IP Forward is completely unavailable. After reactivate the network connection shareing, the problem can be solved.

So, we only need to prepare a scheduled task running the following PowerShell script to make the OS repeat this operation every time when it is booted:

$NetShare = New-Object -ComObject HNetCfg.HNetShare
$wlan = $null
$ethernet = $null

foreach ($int in $NetShare.EnumEveryConnection) {
  $props = $NetShare.NetConnectionProps.Invoke($int)
  if ($props.Name -eq "WLAN") {
    $wlan = $int;
  }
  if ($props.Name -eq "网桥") {
    $ethernet = $int;
  }
}

$wlanConfig = $NetShare.INetSharingConfigurationForINetConnection.Invoke($wlan);
$ethernetConfig = $NetShare.INetSharingConfigurationForINetConnection.Invoke($ethernet);

$wlanConfig.DisableSharing();
$ethernetConfig.DisableSharing();

$wlanConfig.EnableSharing(0);
$ethernetConfig.EnableSharing(1);

References

  1. NetConnectionSharing (PowerShell Module)

从网易云音乐到 Walkman 媒体播放器

2018 年 7 月 9 日分类:Other#PowerShell#SQLite#CSharp

今年六月份突然脑抽想买个很“传统”的 MP3 回来玩玩,于是就从同学那收了这么一个大法的播放器:NW-A45。到手之后检查了一下机器,几乎是全新成色,带一个 64GB 的 TF 卡,非常兴奋。但当我接上了电脑准备开始快乐地复制音乐时,我突然意识到一个问题:我从哪里复制呢?

在高中的时候,我还是保持着从网上收集音乐并整理好的习惯,原因是当时手里的播放器是 Apple iPod nano 6,整理妥当的音乐在使用 iTunes 同步时会方便很多很多。不过后来被人安利了网易云音乐之后,这个收集和整理的习惯就彻底停下来了,原因同样很简单,在线的音乐服务使用起来比自己整理要便捷太多太多。也因为如此,iPod nano 正式退休,开始养(吃)老(灰)。这之后我都是一直使用着网易云音乐,为了解决手机 16GB 存不下音乐的问题还购买了一个 iPod Touch,64G 的版本拿来听歌显然时毫无问题的。就这样,网易云音乐 + iPod Touch 的组合用到了现在。

回到从前的整理音乐+使用工具同步肯定是不会去做的,这辈子都不可能。然而 Walkman 买都买了,不把这个设备用起来就很不服气。仔细思考了一下,网易云音乐上的歌曲其实是可以随意下载的(会员才能下无损,但这不是重点),不过下载了歌曲是会丢失当时整理歌单时的顺序和分类,这一点说重要也不怎么重要,但是我很不愿意半夜听歌时随机到一些奇怪的音乐(比如血源诅咒的 OST,怕不是半夜直接吓醒),所以歌单这一信息还是有必要保留下来的。

MORE

ARM v7 交叉编译笔记

2018 年 5 月 16 日分类:Linux#SDL#Linux

busybox,产生一个最小的可用 coreutils 等工具,并充当新系统的 init,毕竟这种嵌入式场景要是跑 systemd,开机速度什么的就走远了(

$ wget https://busybox.net/downloads/busybox-1.28.3.tar.bz2
$ tar xjvf busybox* && cd busybox*
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- defconfig
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j64
$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- install CONFIG_PREFIX=/root/basefiles

SDL 1.2,把除了 fbcon 之外的 video 和 audio 都关了。SDL 支持的东西真多啊,居然还有 PS2 PS3的。

./configure --host=arm-linux-gnueabihf \
            --prefix=/root/basefiles/usr \
            --disable-audio \
            --disable-threads \
            --disable-x11 \
            --disable-dga \
            --disable-video-photon \
            --disable-video-cocoa \
            --disable-video-directfb \
            --disable-video-ps2gs \
            --disable-video-ps3 \
            --disable-video-svga \
            --disable-video-vgl \
            --disable-video-wscons \
            --disable-video-xbios \
            --disable-video-gem \
            --disable-video-opengl
make && make install

zlib,作为 libpng 和 freetype2 的依赖。

CC=arm-linux-gnueabihf-gcc LD=arm-linux-gnueabihf-ld AS=arm-linux-gnueabihf-as ./configure --prefix=/root/basefiles/usr
make && make install 

libpng 1.6,资源文件保存格式,SDL_image 依赖该库。

必须注意的是头文件目录一定要放在 CPPFLAGS 这个变量里,否则会报错。同时如果 已经报错了记得 make clean 了之后再编译,否则这个错误不会被修正。

./configure --host=arm-linux-gnueabihf \
            --prefix=/root/basefiles/usr \
            CPPFLAGS="-I/root/basefiles/usr/include" \
            LDFLAGS="-L/root/basefiles/usr/lib"
make && make install

SDL_image 1.2,去掉了所有其他用不到的格式,只保留 PNG 的支持。

./configure --host=arm-linux-gnueabihf \
            --prefix=/root/basefiles/usr/ \
            --with-sdl-prefix=/root/basefiles/usr/ \
            --disable-jpg \
            --disable-tif \
            --disable-webp \
            CFLAGS="-I/root/basefiles/usr/include" \
            LDFLAGS="-L/root/basefiles/usr/lib"
make && make install

Freetype2 会通过 pkg-config 命令来判断系统内是否安装了 libpng 和 zlib,所以我们需要手动指定这个 PKG_CONFIG_PATH ,或者干脆去掉对 libpng 的支持。

./configure --host=arm-linux-gnueabihf \
            --prefix=/root/basefiles/usr/ \
            --with-png=yes \
            CFLAGS="-I/root/basefiles/usr/include" \
            LDFLAGS="-L/root/basefiles/usr/lib" \
            PKG_CONFIG_PATH=/root/basefiles/usr/lib/pkgconfig/

SDL_ttf,需要把 include/SDL 内的 SDL_opengl.h 给删掉或者改名,因为 configure 内没有提供任何方法来关闭 OpenGL,只能破坏这个检测机制来避免让 autoconf 认为我需要使用 libGL 进行链接。

[ -e /root/basefiles/usr/include/SDL/SDL_opengl.h ] && mv /root/basefiles/usr/include/SDL/SDL_opengl.h /root/basefiles/usr/include/SDL/SDL_opengl.fucked.h
./configure --host=arm-linux-gnueabihf \
            --prefix=/root/basefiles/usr/ \
            --with-freetype-prefix=/root/basefiles/usr/ \
            CFLAGS="-I/root/basefiles/usr/include -I/root/basefiles/usr/include/freetype2" \
            LDFLAGS="-L/root/basefiles/usr/lib -lfreetype" \
            PKG_CONFIG_PATH=/root/basefiles/usr/lib/pkgconfig/

OpenCV3,测试算法使用,正式代码中使用的部分将被重构

cmake -DCMAKE_TOOLCHAIN_FILE=../arm-gnueabi.toolchain.cmake ../../.. -DCMAKE_INSTALL_PREFIX=/opt/rootfs/usr -DENABLE_NEON=ON
  • «
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • »
Copyright © 2016-2019 ntzyz. All rights reversed.
Except where otherwise noted, content on this blog is licensed under CC-BY 2.0.