二蛋 发布的文章

VirtualBox中安装CentOS最小化版后的网络设置

目标:将VirtualBox中安装的CentOS最小化版设置为和主机在同一网段以实现互访
虚拟机网络设置如下图:
1.jpg
2.jpg

编辑 /etc/sysconfig/network-scripts/ifcfg-eth0 文件

ONBOOT=no
NM_CONTROLLED=yes

修改为

ONBOOT=yes
NM_CONTROLLED=no

复制网卡eth0配置文件

cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 ifcfg-eth1

然后编辑 ifcfg-eth1

DEVICE=eth1
HWADDR=08:00:27:78:26:6C
TYPE=Ethernet
UUID=3e312ec8-f00a-4004-a89f-367105f7e132
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.1.11
NETMASK=255.255.255.0
GATEWAY=192.168.1.1

保存退出并重启网络服务:

service network restart

至此,目标实现!

sftp远程连接命令

sftp 用于在两台计算机之间传输文件,类似于ftp,但是相对于ftp安全得多,sftp默认采用加密方式来传输数据,sftp不是单一命令,而是一系列相关的操作命令。

登陆远程主机,可能要求输入登录密码

sftp -oPort=22 username@remotehost

-oPort = 远程端口号

远程切换目录

cd remotedir

远程创建目录

mkdir dir

显示远程目录中的文件或者目录,可以配合一系列选项使用

ls

将远程文件拷贝到本地制定目录下,如果省略localdir,则直接拷贝到本地目录下

get remotefile localdir

将本地文件上传到远程服务器上,同样remotedir可以省略,则默认到远程所在目录下

put localfile remotedir

删除远程文件

rm remotefile

显示远程主机上的当前路径

pwd

退出sftp

exit

quit

如果想在sftp操作过程中操作本地目录,可以在相关命令上加上l,表示操作本地目录。
例如:
lcd 表示切换本地目录
lpwd 显示本地路径
lrm 删除本地文件
lls 显示本地目录中的文件。

Seacms首页显示分页

<div class="pages">
    <em>1</em><a href='/list/?0-2.html'>2</a><a href='/list/?0-3.html'>3</a><a href='/list/?0-4.html'>4</a><a href='/list/?0-5.html'>5</a><a href='/list/?0-6.html'>6</a><a href='/list/?0-7.html'>7</a><a href='/list/?0-8.html'>8</a><a href='/list/?0-2.html'>下一页</a>
</div>

编辑 /list/index.php 文件,将

if($tid==0){
    showmsg('参数丢失,请返回!', -1);
    exit;
}

if (strpos(" ,".getHideTypeIDS().",",",".$typeId.",")>0) exit("<font color='red'>视频列表为空或被隐藏</font><br>");
    if ($cfg_user == 1){
        if (!getUserAuth($typeId, "list")){exit("<font color='red'>您没有权限浏览此内容!</font><script>function JumpUrl(){history.go(-1);}setTimeout('JumpUrl()',1000);</script>");}
    }

注释掉即可。

Seacms内容页直接显示影片真实地址

1、直接显示实际播放地址
编辑 /include/common.file.func.php/include/common.redis.func.php文件第1247行,将

$urlStr.="<".$listyle.$style." id=\"".$ifrom.$i."\"><a title=\"".$singleUrlArray[0]."\" href=\"".getPlayLink2($typeid,$vId,$sdate,$enname,$ifrom,$i)."\"".$target.">".$singleUrlArray[0]."</a></".$listyle.">";

修改为

$urlStr.="<".$listyle.$style." id=\"".$ifrom.$i."\"><a title=\"".$singleUrlArray[0]."\" href=\"".getPlayLink2($typeid,$vId,$sdate,$enname,$ifrom,$i)."\"".$target.">".$singleUrlArray[0]."$".$singleUrlArray[1]."$".$singleUrlArray[2]."</a></".$listyle.">";

2、直接显示实际下载地址
编辑 /include/common.file.func.php/include/common.redis.func.php文件第1327行,将

$urlStr.="<".$listyle."><a title='".$singleUrlArray[0]."' href='".$singleUrlArray[1]."'".$target.">".($linkstr?$singleUrlArray[1]:$singleUrlArray[0])."</a></".$listyle.">";

修改为

$urlStr.="<".$listyle."><a title='".$singleUrlArray[0]."' href='".$singleUrlArray[1]."'".$target.">".$singleUrlArray[1]."</a></".$listyle.">";

用ffmpeg把mp4切片为ts并生成m3u8列表

for %%a in (*.mp4) do ffmpeg.exe -i %%~na.mp4 -c:v libx264 -c:a aac -strict -2 -hls_time 120 -hls_list_size 0 -hls_allow_cache 1 -f hls %%~na.m3u8

-hls_time n 每段的时长,默认值为2 单位为秒
-hls_list_size n 播放列表保存的最多条目,设置为0会保存所有切片信息,默认值为5
-hls_allow_cache n 高速缓存开关,1为开启。