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
#!/usr/bin/env python | |
# -*- encoding:utf-8 -*- | |
import json | |
import hashlib | |
import base64 | |
from Crypto.Cipher import AES | |
from Crypto.Util.Padding import pad, unpad | |
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
ids = [9, 8, 1, 2, 7, 3] | |
results = Model.objects.filter(id__in=ids).extra( | |
select={'manual': 'FIELD(id,%s)' % ','.join(map(str, ids))}, | |
order_by=['manual'] | |
) |
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
https://press.one/p/address/v?s=47f5bc74b4bf731ac52eb5cad5c2326262c1dda91247c7a6ab519ca6e15a995de946cd2387d7cb6eb9314a3646810f93165d6b49b9199052ac706c63e9b376a10&h=8707eadc65083c9d024da35ee3ce4cf12db2600f50e32ac4f667a81dd2cf2682&a=23315027f25d1b51a6078cf04847d7624138eb87&f=P1&v=2 |
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
class Node(object): | |
def __init__(self, val, left=None, right=None): | |
self.val = val | |
self.left = left | |
self.right = right | |
def max_of_tree(root): | |
if not root: | |
return 0 |