Dec 21

1.Aria2 源码下载
http://sourceforge.net/projects/aria2/files/stable/

2.安装必须的库文件

sudo apt-get install gcc c++ autoconf automake libcppunit-dev  autopoint openssl libtool sphinx-common sphinxsearch libgcrypt11-dev libxml2-dev pkg-config

3.编译安装

tar zxvf aria2-1.17.tar.gz  
cd aria2-1.17.1  
./configure ARIA2_STATIC=yes --enable-bittorrent --enable-metalink

如果编译不能通过,可以删掉 ARIA2_STATIC=yes 选项:

./configure --enable-bittorrent --enable-metalink
make
sudo make install

4.添加启动脚本
/etc/init.d/aria2

#!/bin/sh  
  
### BEGIN INIT INFO  
# Provides:          aria2  
# Required-Start:  
# Required-Stop:  
# Default-Start:  
# Default-Stop:  
# Short-Description: aria2  
### END INIT INFO  
  
case $1 in  
        start)  
                touch /etc/aria2/session.txt  
                /usr/bin/aria2c --conf-path=/etc/aria2/aria2.conf -D  
                ;;  
        stop)  
                killall aria2c  
                ;;  
        *)  
                echo "Usage: /etc/init.d/aria2 {start|stop}"  
                exit 1  
                ;;  
esac  
exit 0

5.增加启动项

sudo update-rc.d aria2 defaults

6.添加 Aria2 配置文件

enable-rpc=true  
rpc-allow-origin-all=true  
rpc-listen-all=true  
rpc-listen-port=6800  
#event-poll=select  
disable-ipv6=true  
  
max-concurrent-downloads=2  
continue=true  
max-connection-per-server=5  
min-split-size=10M  
split=5  
max-overall-download-limit=0  
max-download-limit=0  
max-overall-upload-limit=15k  
max-upload-limit=15k  
#lowest-speed-limit=0  
#referer=*  
input-file=/etc/aria2/session.txt  
save-session=/etc/aria2/session.txt  
save-session-interval=30  
dir=/nas/aria2  
disk-cache=16M  
enable-mmap=true  
  
file-allocation=none  
force-save=true   
  
follow-torrent=true  
bt-hash-check-seed=true  
bt-seed-unverified=true  
bt-save-metadata=true  
#bt-request-peer-speed-limit=2M  
bt-save-metadata=true  
#seed-time=10  
seed-ratio=0.1  
   
log=/etc/aria2/aria2.log  
log-level=error  
max-download-result=50  
Dec 21

1.下载源代码
目前 MiniDLNA 最新版本 1.1.5, 下载地址:
https://sourceforge.net/projects/minidlna/files/minidlna/

2.修改源文件
metadata.c

//line 840  
else if( strncmp(ctx->iformatctx->name, "matroska", 8) == 0 )  
    xasprintf(&m.mime, "video/x-matroska");  
else if( strcmp(ctx->iformatctx->name, "flv") == 0 )  
    xasprintf(&m.mime, "video/x-flv");  
//----add----  
else if( strcmp(ctx->iformat->name, "rm") == 0 )  
    xasprintf(&m.mime, "video/x-pn-realvideo");  
else if( strcmp(ctx->iformat->name, "rmvb") == 0 )  
    xasprintf(&m.mime, "video/x-pn-realvideo");  
//---end----  
if( m.mime )  
    goto video_nodlna;  

upnpglobalvars.h

// Line 169  
    "http-get:*:audio/mp4:*," \  
    "http-get:*:audio/x-wav:*," \  
    "http-get:*:audio/x-flac:*," \  
    "http-get:*:application/ogg:*," \  
//----add----  
    "http-get:*:video/x-pn-realvideo:*"  
//----end----  
  
#define DLNA_FLAG_DLNA_V1_5      0x00100000
#define DLNA_FLAG_HTTP_STALLING  0x00200000

utils.c

//line 381  
        ends_with(file, ".m2t") || ends_with(file, ".mkv")   ||  
        ends_with(file, ".vob") || ends_with(file, ".ts")    ||  
        ends_with(file, ".flv") || ends_with(file, ".xvid")  ||  
//----add----  
        ends_with(file, ".rm")  || ends_with(file, ".rmvb")  ||  
//----end----  
#ifdef TIVO_SUPPORT  
        ends_with(file, ".TiVo") ||  
#endif  
        ends_with(file, ".mov") || ends_with(file, ".3gp"));

3.编译安装

sudo apt-get install build-essential libexif-dev libjpeg-dev \  
libid3tag0-dev libFLAC-dev libvorbis-dev libsqlite3-dev libavformat-dev \  
autoconf automake  
  
./autogen.sh  
./configure  
make  
make install  
sudo cp ./linux/minidlna.inot.d.script.tmpl  /etc/init.d/minidlna  
sudo cp ./minidlna.conf  /etc/minidlna.conf  
  
# 第一次启动使用-d –v选项看有没有出错  
sudo /usr/local/sbin/minidlnad -d -v  
# 没出错就ctrl+c 结束进程  
  
# 正常启动  
sudo service minidlna start  
# 刷新列表  
sudo service minidlna restart  

4.MiniDLNA 配置

# port for HTTP (descriptions, SOAP, media transfer) traffic  
port=8200  
  
# network interfaces to serve, comma delimited  
#network_interface=eth0  
  
# specify the user account name or uid to run as  
#user=jmaggard  
  
# set this to the directory you want scanned.  
# * if you want multiple directories, you can have multiple media_dir= lines  
# * if you want to restrict a media_dir to specific content types, you  
#   can prepend the types, followed by a comma, to the directory:  
#   + "A" for audio  (eg. media_dir=A,/home/jmaggard/Music)  
#   + "V" for video  (eg. media_dir=V,/home/jmaggard/Videos)  
#   + "P" for images (eg. media_dir=P,/home/jmaggard/Pictures)  
#   + "PV" for pictures and video (eg. media_dir=PV,/home/jmaggard/digital_camera)  
media_dir=/opt  
  
# set this to merge all media_dir base contents into the root container  
# note: the default is no  
#merge_media_dirs=no  
  
# set this if you want to customize the name that shows up on your clients  
#friendly_name=My DLNA Server  
  
# set this if you would like to specify the directory where you want MiniDLNA to store its database and album art cache  
#db_dir=/var/cache/minidlna  
  
# set this if you would like to specify the directory where you want MiniDLNA to store its log file  
#log_dir=/var/log  
  
# set this to change the verbosity of the information that is logged  
# each section can use a different level: off, fatal, error, warn, info, or debug  
#log_level=general,artwork,database,inotify,scanner,metadata,http,ssdp,tivo=warn  
  
# this should be a list of file names to check for when searching for album art  
# note: names should be delimited with a forward slash ("/")  
album_art_names=Cover.jpg/cover.jpg/AlbumArtSmall.jpg/albumartsmall.jpg/AlbumArt.jpg/albumart.jpg/Album.jpg/album.jpg/Folder.jpg/folder.jpg/Thumb.jpg/thumb.jpg  
  
# set this to no to disable inotify monitoring to automatically discover new files  
# note: the default is yes  
inotify=yes  
  
# set this to yes to enable support for streaming .jpg and .mp3 files to a TiVo supporting HMO  
enable_tivo=no  
  
# set this to strictly adhere to DLNA standards.  
# * This will allow server-side downscaling of very large JPEG images,  
#   which may hurt JPEG serving performance on (at least) Sony DLNA products.  
strict_dlna=no  
  
# default presentation url is http address on port 80  
#presentation_url=http://www.mylan/index.php  
  
# notify interval in seconds. default is 895 seconds.  
notify_interval=900  
  
# serial and model number the daemon will report to clients  
# in its XML description  
serial=12345678  
model_number=1  
  
# specify the path to the MiniSSDPd socket  
#minissdpdsocket=/var/run/minissdpd.sock  
  
# use different container as root of the tree  
# possible values:  
#   + "." - use standard container (this is the default)  
#   + "B" - "Browse Directory"  
#   + "M" - "Music"  
#   + "V" - "Video"  
#   + "P" - "Pictures"  
#   + Or, you can specify the ObjectID of your desired root container (eg. 1$F for Music/Playlists)  
# if you specify "B" and client device is audio-only then "Music/Folders" will be used as root  
#root_container=.  
  
# always force SortCriteria to this value, regardless of the SortCriteria passed by the client  
#force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title  
  
# maximum number of simultaneous connections  
# note: many clients open several simultaneous connections while streaming  
#max_connections=50  

转自:http://blog.csdn.net/haven200/article/details/43039261#

Dec 10

1.导出数据库

mysqldump -u root -p wordpress > wordpress.sql
%%(输入后会让你输入进入MySQL的密码)
%%(如果导出单张表的话在数据库名后面输入表名即可)

2.导入数据库

mysql -u root -p
%%(输入同样后会让你输入MySQL的密码)
create database wordpress;
%%(创建数据库wordpress)
mysql>use wordpress;
%%(选择数据库wordpress)
mysql>source wordpress.sql;
%%(导入备份的数据库wordpress,必要时需要完整的路径)
Nov 29

语法: mount -t 类型 -o 挂接方式 源路径 目标路径

-t 详细选项:
   光盘或光盘镜像:iso9660
   DOS fat16文件系统:msdos
   Windows 9x fat32文件系统:vfat
   Windows NT ntfs文件系统:ntfs
   Mount Windows文件网络共享:smbfs(需内核支持)推荐cifs
   UNIX(LINUX) 文件网络共享:nfs
-o 详细选项:
   loop :用来把一个文件当成硬盘分区挂接上系统
   ro :采用只读方式挂接设备
   rw :采用读写方式挂接设备
   iocharset :指定访问文件系统所用字符集,例如iocharset=utf8
   remount :重新挂载

使用实例:

挂载windows文件共享:

mount -t smbfs -o username=admin,password=xxx //192.168.1.2/c$ /mnt/samba
mount -t cifs -o username=xxx,password=xxx //IP/sharename /mnt/dirname

挂载Linux文件nfs共享:

mount -t nfs -o rw 192.168.1.2:/usr/www /usr/www

挂载ISO镜像:

mount -o loop -t iso9660 /usr/mydisk.iso /home/pi/cd

挂载USB移动硬盘:

mount -t ntfs /dev/sdc1 /root/usb

挂载CDROM:

mount /dev/cdrom /home/pi/cd

取消挂载:

umount /dev/cdrom /home/pi/cd

单用户模式重新挂载根分区:

mount -o remount,rw /
Nov 21

需要编译安装 ngx_http_substitutions_filter_module 模块,试图屏蔽掉广告但是美元成功,什么时候有时间再尝试一下。

worker_processes auto;
events {
  worker_connections 1024;
}
http {
  include  mime.types;
  default_type application/octet-stream;
  sendfile on;
  gzip on;
  server {
    listen 80;
    server_name yourdomain.com;

    location / {
      proxy_pass https://thepiratebay.org/;
      proxy_set_header Accept-Encoding "";
      proxy_set_header Host thepiratebay.org;
      proxy_set_header CF-Connecting-IP "";
      proxy_set_header Via "$host";
      proxy_ssl_verify off;
      proxy_ssl_server_name on;

      subs_filter 'thepiratebay.org' $host;
    }
  }
}

参考资料:https://proxybay.one/setup.html