typeddict_test 1.759s 372 Kb
schematics_test 2.0 3.188s 152 Kb
schematics_test 1.1 3.339s 96 Kb
This file contains 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
"""find geohashes inside polygon""" | |
from __future__ import division | |
__base32 = '0123456789bcdefghjkmnpqrstuvwxyz' | |
precision = 8 | |
geohash_corners_inside_polygon_policy = any # or all | |
def geohash(lon, lat): | |
result_str = [] |
This file contains 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 PIL import Image | |
from PIL import ImageDraw | |
from math import tanh | |
import random | |
Size = 512 | |
im = Image.new("RGB", (Size, Size), "#fff") | |
draw = ImageDraw.Draw(im) |
This file contains 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
// go test -run none -bench . | |
package b | |
import ( | |
"math/rand" | |
"sort" | |
"testing" | |
) | |
const M = 8192 |
This file contains 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
# coding: utf-8 | |
import threading | |
import time | |
import random | |
import string | |
from django.db import connection | |
from multiprocessing import Pool | |
from django.core.management.base import BaseCommand |
This file contains 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 time | |
import math | |
N = 1000 # any number greater than 1000 | |
class B(object): | |
""" | |
Hash always returns the same value. | |
Then any hash table based on instances of this class will always contain one chain. |
This file contains 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
password | |
123456 | |
12345678 | |
1234 | |
qwerty | |
12345 | |
dragon | |
pussy | |
baseball | |
football |
This file contains 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
module.exports = class Base | |
edge: (which) -> | |
if which == 'start' | |
return 'left' | |
else if which == 'end' | |
return 'right' | |
throw new TypeError('What kind of an edge is ' + which) | |
edgeProp: (edge, prop) -> | |
o = @$el[prop]() | |
o[@edge(edge)] |
This file contains 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
class Mixin(object): | |
def get_queryset(self): | |
raise self.get_object().products.all() | |
class WrongListView(ListCreateAPIView, Mixin): | |
pass | |
class RightListView(Mixin, ListCreateAPIView): |
This file contains 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
class ShopTest(TestCase): | |
def setUp(self): | |
self.network = Network.objects.create() | |
self.region1 = Region.objects.create() | |
self.region2 = Region.objects.create() | |
self.city1 = City.objects.create(region=self.region1) | |
self.city2 = City.objects.create(region=self.region2) | |
self.shop1 = Shop.objects.create( | |
code='0001', | |
cluster=Cluster.objects.create(), |
NewerOlder