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
/// <summary> | |
/// DateTime转Unix时间戳 | |
/// </summary> | |
/// <param name="time"></param> | |
/// <returns></returns> | |
public static long ToTimestamp(this DateTime time) | |
{ | |
return (time.ToUniversalTime().Ticks - 621355968000000000) / 10000000; | |
} |
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
-- ============================================= | |
-- Author: Mike Deng | |
-- Create date: 2014/05/14 | |
-- Description: 杀掉死锁进程 | |
-- ============================================= | |
DECLARE @toKill BIT = 0 --0 或 NULL 只显示, 1.杀掉 | |
BEGIN | |
DECLARE @sql NVARCHAR(MAX); |
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
//pads left | |
String.prototype.lpad = function(padString, length) { | |
var str = this; | |
while (str.length < length) | |
str = padString + str; | |
return str; | |
} | |
//pads right | |
String.prototype.rpad = function(padString, length) { |
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
@echo off | |
cd /d %~dp0 | |
set PATH=%CD%;%PATH% | |
start cmd.exe |
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
[root@localhost ~]#useradd -M -s /sbin/nologin -n username | |
[root@localhost ~]#passwd username |
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
RewriteEngine On | |
RewriteBase / | |
### Force WWW ### | |
RewriteCond %{HTTP_HOST} ^example\.com | |
RewriteRule (.*) http://www.example.com/$1 [R=301,L] | |
## Force SSL ### | |
RewriteCond %{SERVER_PORT} 80 | |
RewriteRule ^(.*)$ https://example.com/$1 [R,L] |
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
@echo sc stop dnsforwarder > !register_as_server.bat | |
@echo sc delete dnsforwarder >> !register_as_server.bat | |
@echo sc create DNSForwarder binPath= "%cd%\srvany.exe" start= auto >> !register_as_server.bat | |
@echo sc description dnsforwarder "UDP to TCP DNS Forwarder" >> !register_as_server.bat | |
@echo reg add HKLM\SYSTEM\CurrentControlSet\Services\dnsforwarder\Parameters /v Application /d "%cd%\dnsforwarder.exe" >> !register_as_server.bat /f | |
@echo reg add HKLM\SYSTEM\CurrentControlSet\Services\dnsforwarder\Parameters /v AppDirectory /d "%cd%" >> !register_as_server.bat /f | |
@echo sc start dnsforwarder >> !register_as_server.bat | |
@echo sc stop dnsforwarder > !delete_dnsproxy_server.bat | |
@echo sc delete dnsforwarder >> !delete_dnsproxy_server.bat |
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
IPT="/sbin/iptables" | |
$IPT -delete-chain | |
$IPT -flush | |
$IPT -P INPUT DROP #1 | |
$IPT -P FORWARD DROP #1 | |
$IPT -P OUTPUT DROP #1 | |
$IPT -A INPUT -m state -state RELATED,ESTABLISHED -j ACCEPT #2 | |
$IPT -A INPUT -p tcp -m tcp -dport 80 -j ACCEPT #3 | |
$IPT -A INPUT -p tcp -m tcp -dport 22 -j ACCEPT #3 | |
$IPT -A INPUT -p tcp -m tcp -dport 21 -j ACCEPT #3 |
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
/*! | |
Math.uuid.js (v1.4) | |
http://www.broofa.com | |
mailto:robert@broofa.com | |
Copyright (c) 2010 Robert Kieffer | |
Dual licensed under the MIT and GPL licenses. | |
*/ | |
/* |
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
/** | |
* Fast UUID generator, RFC4122 version 4 compliant. | |
* @author Jeff Ward (jcward.com). | |
* @license MIT license | |
* @link http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136 | |
**/ | |
var UUID = (function() { | |
var self = {}; | |
var lut = []; for (var i=0; i<256; i++) { lut[i] = (i<16?'0':'')+(i).toString(16); } | |
self.generate = function() { |