Skip to content

Instantly share code, notes, and snippets.

@HuanMeng0
HuanMeng0 / wgkey.sh
Created July 25, 2019 12:28
wgkey.sh
#!/bin/bash
privatekey=`wg genkey`
echo "Private Key:" ${privatekey}
publickey=`echo ${privatekey} | wg pubkey `
echo "Public Key:" ${publickey}
@HuanMeng0
HuanMeng0 / spider.conf
Created July 30, 2016 12:22
屏蔽搜索引擎爬虫(Nginx)
location / {
if ($http_user_agent ~* "qihoobot|Baiduspider|Googlebot|Googlebot-Mobile|Googlebot-Image|Mediapartners-Google|Adsbot-Google|Feedfetcher-Google|Yahoo! Slurp|Yahoo! Slurp China|YoudaoBot|Sosospider|Sogou spider|Sogou web spider|MSNBot|ia_archiver|Tomato Bot")
{
return 403;
}
@HuanMeng0
HuanMeng0 / http.py
Created July 20, 2016 10:48
简易的python http服务器
from BaseHTTPServer import HTTPServer,BaseHTTPRequestHandler
import shutil
class MyHttpHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.end_headers()
self.wfile.write("返回内容")
return
httpd=HTTPServer(('127.0.0.1',80),MyHttpHandler)
@HuanMeng0
HuanMeng0 / m.sh
Created July 20, 2016 10:47
持续监控一个程序是否运行
#!/bin/bash
while [ 1 ]
do
procID=`pgrep APPNAME`
if [ "" == "$procID" ];
then
nowdate=`date '+%Y-%m-%d %H:%M:%S'`
echo "${nowdate}" >> /root/exitlog
exit 0
@HuanMeng0
HuanMeng0 / CentOS-Base.repo
Created May 27, 2016 18:03
清华大学镜像源CentOS6配置文件
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
@HuanMeng0
HuanMeng0 / BlogController.php
Created April 21, 2016 10:29 — forked from tobysteward/BlogController.php
Laravel AJAX Pagination with JQuery
<?php
class BlogController extends Controller
{
/**
* Posts
*
* @return void
*/
public function showPosts()
@HuanMeng0
HuanMeng0 / code
Last active April 19, 2016 21:54
iptables转发Windows3389 RDP流量
iptables -t nat -A PREROUTING -p tcp --dport 3389 -j DNAT --to-destination xxx.xxx.xxx.xxx:3389
iptables -t nat -A POSTROUTING -j MASQUERADE
sysctl net.ipv4.ip_forward=1
@HuanMeng0
HuanMeng0 / cn.nytimes.com.conf
Last active July 16, 2016 06:08
cn.nytimes.com Nginx Proxy Conf
server {
server_name n1.bypassgfw.xyz;
listen 443;
ssl on;
ssl_certificate /root/.startapi.sh/g1.bypassgfw.xyz/g1.bypassgfw.xyz.cer;
ssl_certificate_key /root/.startapi.sh/g1.bypassgfw.xyz/g1.bypassgfw.xyz.key;
location / {
proxy_pass http://cn.nytimes.com/;
proxy_buffering off;