Skip to content

Instantly share code, notes, and snippets.

View RavenZZ's full-sized avatar
🎯
Focusing

Raven RavenZZ

🎯
Focusing
View GitHub Profile
@RavenZZ
RavenZZ / gen.js
Last active March 3, 2017 06:57
根据Mongodb已有索引生成 建立索引脚本
var db = connect(url);
var collections = db.getCollectionNames();
collections.forEach((table)=>{
var commands = [];
var indexes = db[table].getIndexes();
if(indexes.length>0){
@RavenZZ
RavenZZ / gen.js
Last active July 17, 2017 04:44
生成Mongodb索引建立脚本
var db = connect(url);
var dbName = db.getName();
print(`Database: ${dbName}`);
var collections = db.getCollectionNames()
collections.forEach((table)=>{
var commands = [];
var indexes = db[table].getIndexes();
@RavenZZ
RavenZZ / DropAllIndexes.js
Last active July 6, 2016 02:58
Drop All Mongodb Indexes
use taskcenter
var collections = db.getCollectionNames()
collections.forEach((tableName)=>{
if(tableName !=="system.profile"){
print(`db.${tableName}.dropIndexes()`);
}
});
db.currentOp(
{
$or: [
{ op: "command", "query.createIndexes": { $exists: true } }
]
}
)
redis-cli KEYS "prefix:*" | xargs redis-cli DEL
for i in `redis-cli KEYS "keyPrefix:*" | awk -F'"' '{print $1}'`;do redis-cli hset $i fieldName "2";done
@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 {
@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 / showSTATISTICS.sql
Created August 4, 2016 14:53
SQLSERVER显示查询时间
SET STATISTICS PROFILE ON
SET STATISTICS IO ON
SET STATISTICS Time ON
@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();
}