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

Nov 02

1.直接寻找可用的 IP.

通过网络上的 ping 工具,检测得到 Google GHS 的 IP,分别打开下面列表中的网址,查询的地方输入 ghs.google.com 或者 ghs.googlehosted.com,里面得到的每一个 A Records 或响应 IP 就对应一个可以尝试的 GHS IP 地址,然后在本地通过 ping 测试验证是否能用。

http://bgp.he.net/dns/ghs.google.com
https://cloudmonitor.ca.com/en/dnstool.php
http://ping.chinaz.com/

可以将需要绑定的域名直接绑定到 A 记录,如果你有多个域名需要绑定的话,当一个 IP 被屏蔽的话,就需要修改所有的 A 记录。这里有一个小技巧,你可以添加一个可用的 IP 到域名 ghs.domain.com,然后通过 cname 的形式绑定 GAE 域名,这样当需要修改时仅仅需要修改一条 A 记录就可以了。

或者你可以使用网上仍然可用的由 GDG 维护的 ghs 替代域名:

www.goofan.net.g.xgslb.net

当然,这个需要添加 cname 记录。

2.使用 Nginx 直接反向代理
如果有 VPS 的话,可以直接安装 Ngrok,利用 Ngrok 反向代理 GAE,这种方法简单粗暴,一定能成功。但是如果你有多个 GAE 应用的话,就需要添加多段类似的代码,如果嫌麻烦的话可以参考下面第 3 种方法。

server
{
        listen   80;
        server_name xxx.com;

        location /
        {
                proxy_pass http://yyy.appspot.com;
                proxy_set_header Host "yyy.appspot.com";
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
}

3.使用 Nginx 反向代理 Google GHS
最好使用单独的 VPS 来反向代理 Google GHS,代码如下所示,然后添加 A 记录 ghs 到 VPS 的 IP,添加 cname 需要绑定的域名 到 ghs.domain.com。

upstream ghs {
   ip_hash;
   server ghs.google.com;
   server 72.14.203.121;
   server 72.14.207.121;
   server 74.125.43.121;
   server 74.125.47.121;
   server 74.125.53.121;
   server 74.125.77.121;
   server 74.125.93.121;
   server 74.125.95.121;
   server 74.125.113.121;
   server 216.239.32.21;
   server 216.239.34.21;
   server 216.239.36.21;
   server 216.239.38.21;
}

server {
   listen       80;
   server_name  ghs.domain.com;
#下行中的ghs换成自己定义的名称。
    log_format  ghs  '$remote_addr - $remote_user [$time_local] "$request" '
               '$status $body_bytes_sent "$http_referer" '
               '"$http_user_agent" $http_x_forwarded_for';
#下行中两处ghs换成自己定义的名称。
   access_log  /home/log/ghs.log ghs;

   location / {
     proxy_redirect off;
     proxy_set_header Host $host;
     proxy_pass http://ghs;
     proxy_set_header  X-Real-IP  $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_redirect false;
   }

}

server {
   listen       443;
   server_name  ghs.domain.com;
   log_format  mail  '$remote_addr - $remote_user [$time_local] "$request" '
               '$status $body_bytes_sent "$http_referer" '
               '"$http_user_agent" $http_x_forwarded_for';
   access_log  /home/log/mail.log mail;

   location / {
     proxy_redirect off;
     proxy_set_header Host $host;
     proxy_pass http://ghs;
     proxy_set_header  X-Real-IP  $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_redirect false;
   }
}

参考资料:
1.http://steven-wang.appspot.com/nginx-reverse-proxy-122001.html
2.Install Nginx and config Google ghs proxy