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
vi /etc/logrotate.d/celery | |
/var/log/celery/*.log { | |
size=8192k | |
missingok | |
notifempty | |
copytruncate | |
rotate 10 | |
compress | |
delaycompress |
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 elasticsearch import Elasticsearch | |
from elasticsearch.helpers import bulk, scan | |
es = Elasticsearch() | |
BULK_SIZE = 100 | |
INDEX_NAME = 'reviews' | |
ES_QUERY = { | |
"query": { |
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
# $2 column number (starts at 1) | |
awk -F ',' '{print $2}' file.csv | sort | uniq -c |
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
python -m http.server 8000 |
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
TRUNCATE table RESTART IDENTITY; |
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
### Move | |
w, e, b | |
### Edit | |
i, o | |
### Copy & Paste | |
v + d #cut | |
v + y #copy | |
p #paste |
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
syntax on | |
set tabstop=4 | |
set shiftwidth=4 | |
set expandtab | |
set ai | |
set number | |
set hlsearch | |
set ruler | |
colorscheme peachpuff |
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 concurrent.futures import ThreadPoolExecutor, as_completed | |
def get_something(x): | |
return x | |
MAX_WORKERS = 8 | |
iterable = range(20) | |
with ThreadPoolExecutor(max_workers=MAX_WORKERS) as pool: | |
futures = [pool.submit(get_something, x) for x in iterable] | |
for future in as_completed(futures): |
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
# <local_port>:localhost:<remote_port> | |
alias st='open "http://localhost:5601" && ssh server -L 5601:localhost:5601' |
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 datetime import datetime, timedelta | |
from concurrent.futures import ThreadPoolExecutor, as_completed | |
from elasticsearch import Elasticsearch | |
from elasticsearch.helpers import bulk | |
from itertools import zip_longest | |
import csv | |
MAX_WORKERS = 4 | |
BULK_SIZE = 50 |