Skip to content

Instantly share code, notes, and snippets.

@uuz2333
uuz2333 / create_md5.py
Created January 9, 2018 07:52
genete md5
import hashlib
import time
def create_md5():
m = hashlib.md5()
m.update(bytes(str(time.time()), encoding='utf-8'))
return m.hexdigest()
@uuz2333
uuz2333 / django_model_save.py 
Created January 9, 2018 05:49
Resize or Modify an image before saving, copy from https://djangosnippets.org/snippets/10597/ , a back up
rom django.db import models
from PIL import Image
from io import BytesIO
from django.core.files.uploadedfile import InMemoryUploadedFile
import sys
# Create your models here.
class Modify(models.Model):
img = models.ImageField()
@uuz2333
uuz2333 / kaomoji.dict.yaml
Last active November 3, 2017 12:19
仅是颜文字词库, 具体部署参考https://gist.github.com/zolunx10/3848421
# Rime dictionary
# encoding: utf-8
# ref: http://pinyin.sogou.com/dict/ywz/
---
name: kaomoji
version: "0.1"
sort: original
...
←_← ding 25
@uuz2333
uuz2333 / .gitignore
Created November 3, 2017 11:35 — forked from zolunx10/.gitignore
Rime用颜文字(及符号)字典. 个人都绑定到v键开头了, 请下载kaomoji*并酌情修改字典文件.dict.yaml; 另如果要在当前输入法中直接嵌入, 请参考luna_pinyin_simp.custom.yaml前半段修改您的输入法设置.
*
!.gitignore
!alternative.yaml
!*.custom.yaml
!kaomoji.*.yaml
@uuz2333
uuz2333 / uniqObjectsArray.js
Created May 27, 2016 02:45
get uniq Objects array from an array that contain some objects which has same property by es6 systax
export default function uniqObjectsArray(objects) {
/*
objects is an array of Object
*/
let keys = [];
let arr = [];
arr = objects.filter(row => {
let key = JSON.stringify(row);
if (!keys[key]) {
keys[key] = '-';