Skip to content

Instantly share code, notes, and snippets.

View atlanmatrix's full-sized avatar

Claude Manchester atlanmatrix

View GitHub Profile
@atlanmatrix
atlanmatrix / gist:18a7a4f368075776760d1a951ce8ca7f
Last active November 16, 2020 15:39
Python 内置类型的比较
内置数值类型 (数字类型 --- int, float, complex) 以及标准库类型 fractions.Fraction 和 decimal.Decimal 可进行类型内部和跨类型的比较,例外限制是复数不支持次序比较。 在类型相关的限制以内,它们会按数学(算法)规则正确进行比较且不会有精度损失。
非数字值 float('NaN') 和 decimal.Decimal('NaN') 属于特例。 任何数字与非数字值的排序比较均返回假值。 还有一个反直觉的结果是非数字值不等于其自身。 举例来说,如果 x = float('NaN') 则 3 < x, x < 3 和 x == x 均为假值,而 x != x 则为真值。 此行为是遵循 IEEE 754 标准的。
None 和 NotImplemented 都是单例对象。 PEP 8 建议单例对象的比较应当总是通过 is 或 is not 而不是等于运算符来进行。
二进制码序列 (bytes 或 bytearray 的实例) 可进行类型内部和跨类型的比较。 它们使用其元素的数字值按字典顺序进行比较。
字符串 (str 的实例) 使用其字符的 Unicode 码位数字值 (内置函数 ord() 的结果) 按字典顺序进行比较。 3

字典操作

合并(四种方法)

通过.items()方法转化成tuple,相加再转化为dict

dict(dict_a.items() + dict_b.items())

通过update方法

db.getCollection('page').find({site:"cotaiwaterjet", lan:"en"}).forEach(function(doc){
delete doc["_id"]
if (doc.page_name) {
doc['lan'] = 'ko'
page_name_list = doc.page_name.split('')
page_name_list[0] = 'k'
page_name_list[1] = 'o'
doc['page_name'] = page_name_list.join('')
@atlanmatrix
atlanmatrix / gist:4b7c09fb639aa4db0225eae01d4f693a
Created January 17, 2019 06:03 — forked from Shaltz/gist:1d65a07a0901a36fb7f1
HOW TO fix openLDAP checksum error on config files
(source : http://injustfiveminutes.com/category/openldap)
How to fix “ldif_read_file: checksum error”
Posted on October 28, 2014
15
Well, in spite of you did read a banner saying “# AUTO-GENERATED FILE – DO NOT EDIT!! Use ldapmodify.” you ignored it and made some manual modifications in any of the LDIF files in /etc/ldap/slapd.d/.
Don’t worry it happened to me too :) When you need to quickly setup an openLDAP server for development it is pretty much easier to tweak these files although the recommended way is to use ldapmodify tool. But if you change the LDIF files in cn=config manually, their contents and checksums won’t match, which is not fatal, but is annoying when using tools such as slapcat:

top warning

1.颜色(统一管理)
2.下拉框

dashboard

1.header,footer未保存提示
2.location 语言配置,改文案terminal
3.

### 选择show时confirm按钮移动到顶部
### 共享组件添加何处引用
### detailheadline fontsize:14px -> 12px
### share中的show添加阴影和搜索
### show去掉复制,recommend添加复制
@atlanmatrix
atlanmatrix / records of RSB 2.0 8-22.md
Last active August 22, 2018 09:04
records of RSB 2.0 8-22

new page功能不需要手动添加语言

发布菜单的icon修改;修改页面名称时修改状态

pages显示最后修改人name与time

页面编辑按钮上方添加setting按钮,指向meta

页面语言自动创建,根据需要手动删除

@atlanmatrix
atlanmatrix / cloudSettings
Last active August 9, 2018 05:54
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-08-09T05:53:15.989Z","extensionVersion":"v3.0.0"}