This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# monit add : iptables -I OUTPUT -s 你的服务器IP -p tcp --sport 开放的端口 | |
# show : iptables -n -v -L -t filter | |
#统计流量 | |
flowname="/data/log/vpn/flow.log" | |
flownametail="/data/log/vpn/flow_tail.log" | |
flowregex="spt:端口起始到结尾" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1、列出所有的外接存储设备 | |
$ diskutil list external | |
/dev/disk2 (external, physical): | |
#: TYPE NAME SIZE IDENTIFIER | |
0: FDisk_partition_scheme *15.9 GB disk2 | |
1: Windows_NTFS DBand 15.9 GB disk2s1 | |
2、解挂载然后重新挂载 | |
# 解挂载 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function render(template, context) { | |
return template.replace(/\{\{(.*?)\}\}/g, (match, key) => context[key]); | |
} | |
const template = "{{name}}很厉name害,才{{age}}岁"; | |
const context = { name: "yourtion", age: "15" }; | |
console.log(render(template, context)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Place your settings in this file to overwrite the default settings | |
{ | |
"editor.fontFamily": "Hack", | |
"templates.Author": "Yourtion Guo <yourtion@gmail.com>", | |
// Editor | |
"editor.tabSize": 2, | |
"editor.insertSpaces":true, | |
// "editor.formatOnPaste": true, | |
"editor.quickSuggestions": { | |
"other": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { fork } = require('child_process'); | |
const crypto = require('crypto'); | |
const timmer = fork('./timmer.js'); | |
let lastTime = Date.now(); | |
let localTime = Date.now(); | |
timmer.on('message', (m) => { | |
console.log('remote: ', m.time - lastTime - 1000 + 'ms'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 10m; | |
client_body_buffer_size 128k; | |
proxy_connect_timeout 90; | |
proxy_send_timeout 90; | |
proxy_read_timeout 90; | |
proxy_buffer_size 4k; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
import os,sys | |
from xml.etree import ElementTree | |
from PIL import Image | |
import logging | |
DEBUG = False | |
# 设置默认的level为DEBUG |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple | |
git log --oneline -n 1 | |
# val | |
log=`git log --oneline -n 1` && echo $log | |
# Only Mesg | |
log=`git log --oneline -n 1` && $log=${log:8} && echo $log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Copyright 2017 Théo Chamley | |
# Permission is hereby granted, free of charge, to any person obtaining a copy of | |
# this software and associated documentation files (the "Software"), to deal in the Software | |
# without restriction, including without limitation the rights to use, copy, modify, merge, | |
# publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons | |
# to whom the Software is furnished to do so, subject to the following conditions: | |
# | |
# The above copyright notice and this permission notice shall be included in all copies or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 服务器可达返回true | |
#import <arpa/inet.h> | |
- (BOOL)socketReachabilityTest { | |
// 客户端 AF_INET:ipv4 SOCK_STREAM:TCP链接 | |
int socketNumber = socket(AF_INET, SOCK_STREAM, 0); | |
// 配置服务器端套接字 | |
struct sockaddr_in serverAddress; | |
// 设置服务器ipv4 | |
serverAddress.sin_family = AF_INET; | |
// 百度的ip |