Skip to content

Instantly share code, notes, and snippets.

#### work
import typing as t
import asyncio
RateResult = t.Callable[..., t.Coroutine[t.Any, t.Any, None]]
def rate_limit_builder(count_limit: int, time_period: int) -> RateResult:
############ 1
UPDATE tenk1 SET hundred = hundred + 1 WHERE unique1 < 100;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------------------------
Update on tenk1 (cost=5.07..229.46 rows=101 width=250) (actual time=14.628..14.628 rows=0 loops=1)
-> Bitmap Heap Scan on tenk1 (cost=5.07..229.46 rows=101 width=250) (actual time=0.101..0.439 rows=100 loops=1)
Recheck Cond: (unique1 < 100)
-> Bitmap Index Scan on tenk1_unique1 (cost=0.00..5.04 rows=101 width=0) (actual time=0.043..0.043 rows=100 loops=1)
QUERY PLAN
— Index Scan using foo_c1_idx on foo (cost=0.42..34623.01 rows=999519 width=37) (actual time=0.178..1018.045 rows=999500 loops=1)
Index Cond: (c1 > 500)
Total runtime: 1434.429 ms
(3 rows)
QUERY PLAN
— Seq Scan on foo (cost=0.00..20834.12 rows=999522 width=37)
Filter: (c1 > 500)
package company.evo.elasticsearch.rescore;
import org.elasticsearch.common.ParseField;
import org.elasticsearch.common.ParsingException;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.index.fielddata.IndexFieldData;
@Arfey
Arfey / django_query_example.py
Last active April 28, 2019 21:53
django_query_example.py
################################################################
def get_products_list(last_pk=0, batch=1000):
product = Product.objects\
.filter(
id__gte=last_pk,
...
)[:batch]
return product
import * as React from 'react';
type ComponenProps = {
a: string;
};
export function withLikeActions<T extends ComponenProps>(Component: React.ComponentType<T>): React.SFC<T> {
return (props: T) => (
<Component {...props} />
);
@Arfey
Arfey / slack.svg
Last active December 2, 2017 18:03
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Arfey
Arfey / example.json
Last active September 9, 2017 11:45
example.json
{
"lint-staged": {
"*.{js,jsx}": [
"eslint --fix",
"git add"
],
"*.{json,graphql}": [
"prettier --write",
"git add"
],
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<body>
<input id="all" type="checkbox">
import numpy as np
import matplotlib.pyplot as plt
from math import *
import pylab
from matplotlib import mlab
dlin_p=3; glub=-1; lamda=0.8; kv=2*3.14/lamda;
dx=lamda/0; dt=dx; dlin=round(23.0/dx); X_ros=0;