Skip to content

Instantly share code, notes, and snippets.

@zhangpengGenedock
zhangpengGenedock / mongodb create unique index
Created July 5, 2017 03:33
mongodb create unique index
db.collection.createIndex( { a: 1 }, { unique: true } )
@zhangpengGenedock
zhangpengGenedock / compound index hint and explain
Created July 3, 2017 09:01
compound index hint and explain
.hint({ quantity: 1, type: 1 }).explain("executionStats")
.explain("executionStats")
@zhangpengGenedock
zhangpengGenedock / git co tag
Created June 29, 2017 03:20
git checkout to specific tag
git checkout tags/1.1.4
on alfred_script(q)
if application "iTerm2" is running or application "iTerm" is running then
run script "
on run {q}
tell application \":Applications:iTerm.app\"
activate
try
select first window
set onlywindow to false
on error
@zhangpengGenedock
zhangpengGenedock / github workflow crash solution.txt
Last active June 19, 2017 11:08
github workflow 崩溃解决办法
github workflow crash solution
I can't tell you why it worked, but deleting the workflow's working directory
(/Users/$USER/Library/Application Support/Alfred 3/Workflow Data/de.gh01.alfred.github)
cleared the cache and things seem to work again.
@zhangpengGenedock
zhangpengGenedock / mongodb collection group by example
Last active June 19, 2017 06:47
mongodb pymongo collection group by example.py
start_date = str(get_format_date(begin_timestamp))
end_date = str(get_format_date(end_timestamp))
match = {
'date': {
'$gte': start_date,
'$lte': end_date,
}
}