This file contains hidden or 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/env python | |
import os | |
import psutil | |
import resource | |
import subprocess | |
import sys | |
import time | |
This file contains hidden or 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
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
# C extensions | |
*.so | |
# VIM | |
*.swp |
This file contains hidden or 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
from django.core.paginator import Paginator | |
def chunked_iterator(queryset, chunk_size=10000): | |
paginator = Paginator(queryset, chunk_size) | |
for page in range(1, paginator.num_pages + 1): | |
for obj in paginator.page(page).object_list: | |
yield obj | |
for event in chunked_iterator(Event.objects.all()): | |
print event |
This file contains hidden or 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/env python | |
# -*- coding:utf-8 -*- | |
# | |
# Author : zhangxiaolin | |
# E-mail : [email protected] | |
# Date : 16/11/4 14:49 | |
# Desc : ... | |
""" | |
唯一一个限制字典:不能存以 `_` 开头的key |
This file contains hidden or 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/env python | |
# -*- coding:utf-8 -*- | |
# | |
# Author : zhangxiaolin | |
# E-mail : [email protected] | |
# Date : 16/11/3 16:03 | |
# Desc : ... | |
from queue import Queue | |
import socket | |
import select |
This file contains hidden or 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
### in zsh config | |
compdef _go go | |
### 补全脚本 | |
(pycharm_ascle) [~]$ cat .fpath/_go | |
#compdef go | |
_1st_arguments=( | |
"test" | |
"dev" |
This file contains hidden or 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
(pycharm_ascle) [~]$ cat .git-templates/hooks/pre-commit | |
#!/usr/bin/env bash | |
git diff --cached -- '*.py' | `which pep8` --max-line-length=119 --show-source --diff | |
if [ $? -gt 0 ]; then | |
echo | |
echo '--------' | |
echo 'Lint check failed.' | |
exit 1 |
This file contains hidden or 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/env python | |
# -*- coding:utf-8 -*- | |
# | |
# Author : zhangxiaolin | |
# E-mail : [email protected] | |
# Date : 16/11/3 16:03 | |
# Desc : ... | |
import queue | |
from queue import Queue | |
import socket |
This file contains hidden or 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/env python | |
# -*- coding:utf-8 -*- | |
# | |
# Author : zhangxiaolin | |
# E-mail : [email protected] | |
# Date : 17/11/1 20:00 | |
# Desc : ... | |
import types | |
from selectors import DefaultSelector, EVENT_WRITE, EVENT_READ | |
from collections import deque |
This file contains hidden or 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
dash_id=xxxx | |
api_key=xxx | |
app_key=xxx | |
# 1. export | |
curl -X GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${api_key}&application_key=${app_key}" > dash.json | |
# 2. edit dash.json | |
move "graphs", "title", "description" up one level in the json hierarchy, from being beneath "dash" to being at the same level |
OlderNewer