https://docs.djangoproject.com/en/2.1/topics/db/optimization/
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
x = np.arange(3000) | |
vet = np.vectorize(elo2tier) | |
y = vet(x) |
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
dic = dict() | |
key, value = 'some key', 'some value' | |
dic[key] = dic.get(key, []) + [value] | |
dic.setdefault(key,[]).append(value) | |
# doesn't work: | |
# dic[key] = dic.get(key, []).append(value) | |
# https://docs.python.org/3/library/stdtypes.html#dict.setdefault |
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.db import connection | |
import logging | |
logger = logging.getLogger(__name__) | |
class QueryCountDebugMiddleware(object): | |
""" | |
This middleware will log the number of queries run | |
and the total time taken for each request (with a | |
status code of 200). It does not currently support |
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
import click | |
@click.command() | |
@click.option('--count', default=1, help='Number of greetings.') | |
@click.option('--name', prompt='Your name', | |
help='The person to greet.') | |
def hello(count, name): | |
"""Simple program that greets NAME for a total of COUNT times.""" | |
for x in range(count): | |
click.echo('Hello %s!' % name) |
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
import sys | |
import time | |
toolbar_width = 40 | |
# setup toolbar | |
sys.stdout.write("[%s]" % (" " * toolbar_width)) | |
sys.stdout.flush() | |
# return to start of line, after '[' | |
sys.stdout.write("\b" * (toolbar_width + 1)) |
PasswordAuthentication no
PubkeyAuthentication no
Then add desired authentication methods after a Match Address in the end of the file. Placing Match in the end of the file is important, since all the configuration lines after it are placed inside the conditional block until the next Match line. For example:
Match Address 127.0.0.*
PubkeyAuthentication yes
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
<!-- thanks: https://qiita.com/zakiyamaaaaa/items/bdda422db2ccbaea60d9 --> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script> | |
<button id="ajax">ajax</button> | |
<div class="result"></div> | |
<script type="text/javascript"> | |
$(function(){ | |
// Ajax button click | |
$('#ajax').on('click',function(){ |
https://note.nkmk.me/python-pandas-rolling/
pandas rolling
Installation: https://docs.mongodb.com/manual/installation/#install-mongodb
brew
brew services start mongodb
Usage