Skip to content

Instantly share code, notes, and snippets.

@mildcore
mildcore / first.md
Last active April 11, 2020 09:27
First Gist

This is my first gist.

@mildcore
mildcore / txt
Created June 8, 2017 04:45
Second Gist
This is a Text.
@mildcore
mildcore / PhotoBucket.md
Last active June 10, 2017 06:08
PhotoBucket

Photobucket是一个提供影像寄存、视频寄存、幻灯片制作与照片分享服务网站,于2003年由Alex Welch与Darren Crystal利用Trinity Ventures提供的资金创。Photobucket一般会用作个人相册,寄存网络论坛上显示的头像以及视频的远端存放空间。

@mildcore
mildcore / mysql_encoding.md
Created April 19, 2020 11:44
Verify that tables have utf8 set. Set connection charset. Check database settings.

https://stackoverflow.com/a/11013986

I would not suggest Richies answer, because you are screwing up the data inside the database. You would not fix your problem but try to "hide" it and not being able to perform essential database operations with the crapped data.

If you encounter this error either the data you are sending is not UTF-8 encoded, or your connection is not UTF-8. First, verify, that the data source (a file, ...) really is UTF-8.

Then, check your database connection, you should do this after connecting:

SET NAMES 'utf8'; SET CHARACTER SET utf8;

..\MySQL\MySQL Server 5.7\DATA\my.ini
------------这两个可以省略-------------------------
[client]
default-character-set=utf8mb4
[mysql]
default-character-set=utf8mb4
-----------just use this----------------------------
# system-time-zone could be set in OS ENVIRON [TZ=CST-8:00], if mysql failed to get from os by default.
# default-time-zone could be removed [SYSTEM by default] if system-time-zone is rightly getted by mysql.
Note:举例说明以中国时间为主体
1.时区定义TZ
含义:CST代表时区的别名,后面的+8:00才是实际定义时区的;
# 下面两个其实代表同一个时区,只是时区别名不一样,区别在于这里的名字ABC是非标准的. 但其实CST本身也有很多国家在用,比如美国、中国。
TZ=CST-8:00
TZ=ABC-8:00
# 默认为+0,当然-0也没毛病, 可不写出来;其实对于TZ来讲这时候标准别名应该用UTC,ZZZ是随意的一个名字。
TZ=ZZZ
TZ=ZZZ+0
先说解决方式:
Windows TZ环境变量设置:
TZ=CST-8:00
以下为一些心得:
MySQL的system_time_zone读取错误的问题,会导致以下类似命令出现Warning:
show variables like '%time_zone%';
show variables like '%char%';
#!usr/bin/env python3
# -*- coding: utf-8 -*-
r"""
本代码的例子一个扩展平面字符CJK统一表意文字扩展B第一个字符。(你的环境可能无法正确显示实际字符可自行搜索代码点
https://unicode-table.com/en/20000/
𠀀
U+20000
1.Unicode编码标准
摘要算法Digest
特点:不可反解,单向计算;固定长度,不会保存也无法恢复原有资源。
MD5 128bit # 不够安全
SHA1: 即SHA160, 160bit
SHA2: SHA-224、SHA-256、SHA-384、SHA-512、SHA-512/224、SHA-512/256等的统称
作用:
<1>一般是用来对密码进行加密存储【此加密非彼加密】,目的是防泄露密码明文。即便
一个网站密码库被黑客攻破, 也不会让用户其他网站帐号遭受危险;
<2>用来对一个资源生成摘要,接收者对资源也生成摘要来比对,防资源修改、缺失;

1. pip basic use

upgrade:
python -m pip install --upgrade pip setuptools wheel
while pip unreachable/uninstalled:
python -m ensure pip
while pip upgrade itself failed:
remove the directory like "\Lib\site-packages\pip-20.0.2.dist-info"