海运的博客

php使用deluge

发布时间:October 10, 2018 // 分类:PT // No Comments

使用https://github.com/kaysond/deluge-php 提供的类,简单使用:

$host = "192.168.168.5:8112";
$password = "deluge";
$d = new deluge($host, $password);
//返回只包含当前状态Downloading中的
$filter = array('state' => "Downloading");
//返回指定的这此参数的值
$params = array('name', 'hash', 'max_upload_speed', 'eta');
$list = $d->getTorrentsStatus($filter, $params, '');
var_dump($list);
$url = 'https://www.haiyun.me/deluge.torrent';
$options = array('max_upload_speed' => 100, 'max_download_speed' => 100);
$res = $d->addTorrentUrl($url, $options, '');
var_dump($res);

参考:
https://media.readthedocs.org/pdf/deluge/develop/deluge.pdf

ubuntu18.04编译安装deluge

发布时间:October 10, 2018 // 分类:PT // No Comments

安装编译环境及libtorrent依赖:

apt-get install build-essential checkinstall pkg-config automake libtool git
apt-get install libboost-system-dev libboost-python-dev libboost-chrono-dev libboost-random-dev libssl-dev

使用最新版libtorrent:

wget https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_1_10/libtorrent-rasterbar-1.1.10.tar.gz
tar zxvf libtorrent-rasterbar-1.1.10.tar.gz 
cd libtorrent-rasterbar-1.1.10/
./configure --prefix=/usr/local/libtorrent --enable-python-binding --with-libiconv
make clean && make -j$(nproc) && make install
echo '/usr/local/libtorrent/lib' > /etc/ld.so.conf.d/libtorrent-x86_64.conf 
ldconfig
export PYTHONPATH=$PYTHONPATH:/usr/local/libtorrent/lib/python2.7/site-packages/
echo 'export PYTHONPATH=$PYTHONPATH:/usr/local/libtorrent/lib/python2.7/site-packages/' >> ~/.bashrc

查看python能否调用libtorrent:

python -c "import libtorrent; print libtorrent.version"

安装deluge依赖:

apt-get install python python-twisted python-openssl python-setuptools intltool python-xdg python-chardet geoip-database python-libtorrent python-notify python-pygame python-glade2 librsvg2-common xdg-utils python-mako 

安装deluge:

wget http://download.deluge-torrent.org/source/deluge-1.3.15.tar.gz
tar -xzvf deluge-1.3.15.tar.gz
cd deluge-1.3.15
mkdir -p /usr/local/deluge/lib/python2.7/site-packages/
export PYTHONPATH=$PYTHONPATH:/usr/local/deluge/lib/python2.7/site-packages/
echo 'export PYTHONPATH=$PYTHONPATH:/usr/local/deluge/lib/python2.7/site-packages/' >> ~/.bashrc
python setup.py build
python setup.py install --prefix /usr/local/deluge
export PATH=$PATH:/usr/local/deluge/bin/
echo 'export PATH=$PATH:/usr/local/deluge/bin/' >> ~/.bashrc

使用libtorrent1.0.11版本:

git clone https://github.com/arvidn/libtorrent.git
cd libtorrent
git checkout origin/RC_1_0
./autotool.sh
./configure --prefix=/usr/local/libtorrent --enable-python-binding --with-libiconv
make clean && make -j$(nproc) && make install

ubuntu编译安装qbittorrent:https://www.haiyun.me/archives/1253.html
centos7编译安装deluge:https://www.haiyun.me/archives/1240.html
参考:
https://dev.deluge-torrent.org/wiki/Building/libtorrent
https://dev.deluge-torrent.org/wiki/Installing/Source

Linux挂载多分区img文件

发布时间:October 9, 2018 // 分类: // No Comments

制作个1G大小的img文件并分区:

fallocate -l $(( 1024 * 1024 *1024 )) file.img

如果util-linux版本>=2.21可直接挂载为多分区loop设置,然后挂载到目录:

#自动选择设备名
losetup -f --show -P file.img 
#指定设置名
losetup -P /dev/loop100 file.img    
mount /dev/loop100p1 /mnt/
umount /mnt
losetup -d /dev/loop100   

否则指定起始分区位置和大小挂载指定分区,先查看各分区起始位置和大小:

fdisk -l file.img  
Device     Boot  Start     End Sectors  Size Id Type
file.img1         2048  206847  204800  100M 83 Linux
file.img2       206848 2097151 1890304  923M 83 Linux

如果挂载第一个分区,起始为第2048个扇区,204800个扇区大小,每个扇区512 byte,挂载时设置起始位置2048512,大小204800512:

losetup -f --show -o 1048576 --sizelimit 104857600 file.img 

也可安装kpartx挂载:

kpartx -v -a file.img
kpartx -d /dev/loop100   
mount /dev/mapper/loop0p1 /mnt/

n1盒子降级刷官改系统

发布时间:October 8, 2018 // 分类:N1 // No Comments

开启adb,点击版本号3次,提示调试模式开启,配置无线连接获取IP,用adb连接IP重启到fastboot模式。
windows下的adb和fastboot工具:https://dl.google.com/android/repository/platform-tools-latest-windows.zip

adb connect 192.168.168.239
adb shell reboot fastboot

刷入降级分区:http://www.right.com.cn/forum/thread-322223-1-1.html
重新启动后进入logo界面,使用双公头usb线连接电脑和挨着盒子hdmi旁边的那个usb口,设备管理器更新驱动,然后使用fastboot降级,不降级不能线刷官改系统。

c:\platform-tools>fastboot.exe devices
CAQDB3064K12828 fastboot

c:\platform-tools>fastboot.exe flash boot boot.img
Sending 'boot' (13858 KB)                          OKAY [  0.641s]
Writing 'boot'                                     OKAY [  0.534s]
Finished. Total time: 1.188s

c:\platform-tools>fastboot.exe flash bootloader bootloader.img
Sending 'bootloader' (656 KB)                      OKAY [  0.048s]
Writing 'bootloader'                               OKAY [  0.047s]
Finished. Total time: 0.109s

c:\platform-tools>fastboot.exe flash recovery recovery.img
Sending 'recovery' (17866 KB)                      OKAY [  0.813s]
Writing 'recovery'                                 OKAY [  0.797s]
Finished. Total time: 1.640s

c:\platform-tools>fastboot.exe reboot
Rebooting
Finished. Total time: 0.000s

如果仅使用armbian/linux系统可以略过下面的部分了。
刷入官改系统,http://www.right.com.cn/forum/thread-338759-1-1.html
安装USB_Burning_Tool_v2.1.6线刷工具,导入镜像去除勾选擦除flash和擦除bootloader,用双公头usb线连接电脑和盒子(靠近hdmi usb),点击开始,然后用adb连接盒子重启到刷机模式:

adb shell reboot update 

2018-10-08_074823.png
启动后会自动开始刷机,等进度条变成绿色并显示100%烧录完成时点击停止,关闭USB_Burning_Tool,断开usb线,断电重启盒子即可进入新系统。

参考:
https://www.mivm.cn/phicomm-n1-unofficial/
https://github.com/jxjhheric/n1-setup
https://chisec.cc/phicomm-fucking/

小内存VPS通过网络重新安装Centos7系统指定安装时运行镜像位置

发布时间:October 6, 2018 // 分类: // No Comments

centos7网络安装启动后会从网络获取安装时运行的镜像,默认从安装源目录.treeinfo文件中读取,如在ks文件中指定url --url=http://mirror.centos.org/centos/7/os/x86_64,.treeinfo文件信息如下:

curl http://mirror.centos.org/centos/7/os/x86_64/.treeinfo
[general]
name = CentOS-7
family = CentOS
timestamp = 1525379658.57
variant = 
version = 7
packagedir = 
arch = x86_64

[stage2]
mainimage = LiveOS/squashfs.img

[images-x86_64]
kernel = images/pxeboot/vmlinuz
initrd = images/pxeboot/initrd.img
boot.iso = images/boot.iso

[images-xen]
kernel = images/pxeboot/vmlinuz
initrd = images/pxeboot/initrd.img

如果没有.treeinfo文件则从从LiveOS目录中取squashfs.img,由于squashfs.img文件较大,默认从HTTP安装时获取squashfs.img文件再运行会占用很大的内存,测试安装centos7 1.5G以上内存才能正常安装,对于512M左右的内存的VPS可以将squashfs.img文件放到本地硬盘或NFS上,这样小内存VPS也能通过网络重新安装centos7系统了。
1.通过本地硬盘,缺点是所占用的分区不能在重新安装系统时更改,如将squashfs.img文件放到sda2分区/LiveOS/目录中,在引导项中指定inst.stage2参数:

linux16 /vmlinuz inst.stage2=hd:sda2:/

2.通过NFS,同样将squashfs.img文件放到导出/mnt分区/LiveOS/目录中,这样安装系统时可使用整个硬盘。

#nfsvers=4 nfs服务器为版本4,默认是3
inst.stage2=nfs:nfsvers=4:www.haiyun.me:/mnt/

其它可参考:
通过ipxe自动安装centos/ubuntu系统:https://www.haiyun.me/archives/1246.html
网络安装centos/ubuntu自动配置脚本:https://www.haiyun.me/archives/1250.html

分类
最新文章
最近回复
  • 海运: 恩山有很多。
  • swsend: 大佬可以分享一下固件吗,谢谢。
  • Jimmy: 方法一 nghtp3步骤需要改成如下才能编译成功: git clone https://git...
  • 海运: 地址格式和udpxy一样,udpxy和msd_lite能用这个就能用。
  • 1: 怎么用 编译后的程序在家里路由器内任意一台设备上运行就可以吗?比如笔记本电脑 m参数是笔记本的...
  • 孤狼: ups_status_set: seems that UPS [BK650M2-CH] is ...
  • 孤狼: 擦。。。。apcupsd会失联 nut在冲到到100的时候会ONBATT进入关机状态,我想想办...
  • 海运: 网络,找到相应的url编辑重发请求,firefox有此功能,其它未知。
  • knetxp: 用浏览器F12网络拦截或监听后编辑重发请求,修改url中的set为set_super,将POS...
  • Albert: 啊啊啊啊啊啊啊啊啊 我太激动了,终于好了英文区搜索了半天,翻遍了 pve 论坛没找到好方法,博...