Skip to content

Instantly share code, notes, and snippets.

var path = require('path');
var express = require('express');
var nunjucks = require('nunjucks');
var app = express();
var ytdl = require("youtube-dl");
var request = require("request");
var utils = require('utility');
// view engine setup
nunjucks.configure('views', {
@wdfsinap
wdfsinap / renameMongoField.js
Created April 20, 2016 20:20 — forked from guyellis/renameMongoField.js
How to rename a field in all documents in a collection in MongoDB
// Params
// 1. {} add a query in here if you don't want to select all records (unlikely)
// 2. $rename one or more fields by setting the keys of the object to the old field name and their values to the new field name.
// 3. Set multi to true to force it to operate on all documents otherwise it will only operate on the first document that matches the query.
//
// Run this in the MongoDB shell.
db.<collectionName>.update( {}, { $rename: { '<oldName1>': '<newName1>', '<oldName2>': '<newName2>' } }, {multi: true} )
@wdfsinap
wdfsinap / proxy.conf
Created August 8, 2012 15:34
proxy.conf for LLNMP
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 50m;
client_body_buffer_size 256k;
proxy_connect_timeout 30;
proxy_send_timeout 30;
proxy_read_timeout 60;
@wdfsinap
wdfsinap / phpinfo.php
Created August 8, 2012 15:33
phpinfo.php for LLNMP
<?php
phpinfo();
?>
@wdfsinap
wdfsinap / p.php
Created August 8, 2012 15:33
p.php for LLNMP
<?php
/* ----------------modified from Yahei--------------------- */
error_reporting(0); //抑制所有错误信息
@header("content-Type: text/html; charset=utf-8"); //语言强制
ob_start();
$title = "PHP探针";
$version = "v0.4.0"; //版本号
@wdfsinap
wdfsinap / nginx.conf
Created August 8, 2012 15:32
default nginx.conf for LLNMP
user www www;
worker_processes 1;
error_log /usr/local/nginx/logs/nginx_error.log crit;
pid /usr/local/nginx/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 1024;
events
{
use epoll;
worker_connections 1024;
@wdfsinap
wdfsinap / init.d.nginx
Created August 8, 2012 15:31
init.d.nginx for LLNMP
#!/bin/sh
#
# nginx – this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /opt/nginx/conf/nginx.conf
# pidfile: /opt/nginx/logs/nginx.pid
@wdfsinap
wdfsinap / index.html
Created August 8, 2012 15:30
index file for LLNMP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>LLNMP一键安装包 by vpssh.org</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="author" content="zhumaohai">
<meta name="keywords" content="LLNMP,LLNMP一键安装包,一键安装包">
<meta name="description" content="您已成功安装lLNMP一键安装包!">
<style type="text/css">
<!--
@wdfsinap
wdfsinap / vhost.sh
Created August 8, 2012 15:29
add host for LLNMP
#!/bin/bash
#Add virtual host
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
# Check if user is root
if [ $(id -u) != "0" ]; then
printf "Error: You must be root to run this script!\n"
exit 1
fi
@wdfsinap
wdfsinap / llnmp.sh
Created August 8, 2012 15:27
LiteSpeed+Nginx+Mysql+PHP
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
cur_dir=$(pwd)
#set up email
email="root@localhost.com"
echo "Please input email:"
printf "(Default email: root@localhost.com):"
read email
echo ""