Skip to content

Instantly share code, notes, and snippets.

View RavenZZ's full-sized avatar
🎯
Focusing

Raven RavenZZ

🎯
Focusing
View GitHub Profile
@RavenZZ
RavenZZ / Startup.cs
Last active August 25, 2016 08:53
ASP.NET Core-获取所有注入(DI)服务
public class Startup
{
private IServiceCollection _services;
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
_services = services;
}
@RavenZZ
RavenZZ / showConnection.sh
Created August 5, 2016 16:46
Show Connection Count
netstat -ant | awk '{print $6}' | sort | uniq -c | sort -n
@RavenZZ
RavenZZ / sleep.js
Created August 5, 2016 01:51
javascript模拟线程阻塞
function sleep(milliSeconds) {
var startTime = new Date().getTime();
while (new Date().getTime() < startTime + milliSeconds);
}
@RavenZZ
RavenZZ / clearSelection.js
Created August 5, 2016 01:46
Clear Text Selection with JavaScript
if (window.getSelection) {
if (window.getSelection().empty) { // Chrome
window.getSelection().empty();
} else if (window.getSelection().removeAllRanges) { // Firefox
window.getSelection().removeAllRanges();
}
} else if (document.selection) { // IE?
document.selection.empty();
}
@RavenZZ
RavenZZ / showSTATISTICS.sql
Created August 4, 2016 14:53
SQLSERVER显示查询时间
SET STATISTICS PROFILE ON
SET STATISTICS IO ON
SET STATISTICS Time ON
@RavenZZ
RavenZZ / index.sql
Created August 4, 2016 14:52
查询SQLSERVER所有索引
SELECT
TableName = t.name,
IndexName = ind.name,
IndexId = ind.index_id,
ColumnId = ic.index_column_id,
ColumnName = col.name,
ind.*,
ic.*,
col.*
FROM
@RavenZZ
RavenZZ / nginx.conf
Created August 4, 2016 14:49
openresty负载均衡下的特殊应用–特定请求转发所有后端主机
upstream weblist {
server 192.168.1.2:80 weight=1;
server 192.168.1.3:80 weight=1;
}
server {
listen 8080
default_server;
server_name _;
location /cache {
for i in `redis-cli KEYS "keyPrefix:*" | awk -F'"' '{print $1}'`;do redis-cli hset $i fieldName "2";done
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
db.currentOp(
{
$or: [
{ op: "command", "query.createIndexes": { $exists: true } }
]
}
)