Skip to content

Instantly share code, notes, and snippets.

View gaozhidf's full-sized avatar
💭
I may be slow to respond.

里丰 gaozhidf

💭
I may be slow to respond.
View GitHub Profile
#!/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
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']
)
https://press.one/p/address/v?s=47f5bc74b4bf731ac52eb5cad5c2326262c1dda91247c7a6ab519ca6e15a995de946cd2387d7cb6eb9314a3646810f93165d6b49b9199052ac706c63e9b376a10&h=8707eadc65083c9d024da35ee3ce4cf12db2600f50e32ac4f667a81dd2cf2682&a=23315027f25d1b51a6078cf04847d7624138eb87&f=P1&v=2
@gaozhidf
gaozhidf / tree.py
Created March 22, 2018 16:11 — forked from anonymous/tree.py
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