Skip to content

Instantly share code, notes, and snippets.

package main
import (
cryptorand "crypto/rand"
"math/rand"
"errors"
"sync"
"fmt"
"time"
)
@PirosB3
PirosB3 / main.py
Created January 13, 2016 08:17
Quora.challenge
import itertools
import sys
def non_increasing_range(items, i, j, _c):
try:
d = _c[(i, j)]
return d
except KeyError:
pass
package main
import "fmt"
type Grid []uint
func (g *Grid) NewGrid(width int, height int) {
for i:=0; i < height; i++ {
*g = append(*g, 0)
}
# Let's combine some queries together!
GET /bank/account/_search
{
"query": {
"bool": {
"must": [{
"match": {
"address": "court"
}
}],
# Let's start by checking how many documents we have in the collection
GET /bank/account/_count
# A simple search. The word "Michael" must be fully conatiend somewhere in the specified field.
# A score is given to each document retrieved
GET /bank/account/_search
{
"query": {
"match": {
"address": "Temple Court"
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py
index d8f7fe5..7a7c651 100644
--- a/django/contrib/admin/checks.py
+++ b/django/contrib/admin/checks.py
@@ -560,9 +560,10 @@ class ModelAdminChecks(BaseModelAdminChecks):
id='admin.E105',
)
]
- elif not issubclass(inline.model, models.Model):
- return must_be('a Model', option='%s.model' % inline_label,
import heapq
import itertools
def _insert(dic, c):
try:
return dic[c]
except KeyError:
dic[c] = {}
return dic[c]
import random
import math
def random_number_generator(base, power, base_num):
if power == 1:
return base()
return int((base_num ** (power-1)) * base() + random_number_generator(base, power-1, base_num))
def generate_given(rand_num, target_rand_range):
if target_rand_range < rand_num:
import copy
import itertools
from collections import defaultdict
import numpy as np
def get_minigrid_for_coord(i, j):
h = i / 3
w = j / 3
return w, h
import copy
import itertools
from collections import defaultdict
import numpy as np
def get_minigrid_for_coord(i, j):
h = i / 3
w = j / 3
return w, h