Chen's Note

Cast a code eye, on Life on Death


  • Home

  • Categories

  • Tags

  • Archives

  • TODO

  • colors

  • Search

AWS

Posted on 2019-07-19 | | Visitors:
S3Disable “delete” option for S3 objects in AWS Attach policy to your IAM user(s) that Deny s3:DeleteObject action Configure bucket policy (Permissions -> Bucket Policy) that will Deny s3:DeleteObject actionFor example, bucket policy can look like this: 12345678910111213{ "Version": "2012-10-17", "Id": "<...>", "Statement" ...
Read more »

python3

Posted on 2019-05-31 | | Visitors:
Compression1. compress12345import zlib...zlib.compress(str.encode("utf-8"))// compress requires byte 2. decompress1234import zlib...zlib.compress(byte).decode("utf-8") 3. Dynamodb Binary12345from boto3.dynamodb.types import Binary# dynamodb.Binary Obj has attr: valueif isinstance(Item[column_name], Binary): box_plot_str = zlib.decompress(Item[column_name].column.value).decode(& ...
Read more »

CSS:绘制矩形、圆角矩形、圆形、椭圆形、三角形、弧

Posted on 2019-01-17 | | Visitors:
Demo: https://codepen.io/xc454981894/pen/oJROBZ 1.矩形绘制矩形应该是最简单的了,直接设置div的宽和高,填充颜色,效果就出来了。 2.圆角矩形绘制圆角矩形也很简单,在1的基础上,在使用css3的border-radius,即可。 3.圆根据圆的特性,在2的基础上,设置div的宽和高一直,为正方形,然后设置border-radius为50%即可。 4.椭圆椭圆也很简单了,只需要在3的基础上,让div的宽和高不一致即可。为了更好看,建议宽设置为高的1.5倍。 5.三角形三角形相对其他来说,就有点难了。这里我们要用到border-style属性在配合分别设置四个边的border的宽度来实现。最终效果见下面的代码。 6.弧本质上是利用圆角来实现,现在需要把矩形的左上角的圆角绘制成弧形,那么把右边和底边border的宽度设成0px,让他们不可见,设置 ...
Read more »

Scrapy

Posted on 2019-01-17 | | Visitors:
pip3 listhttps://doc.scrapy.org/en/latest/intro/tutorial.html Create a projectscrapy startproject tutorial This will create a tutorial directory with the following contents: 12345678910111213141516tutorial/ scrapy.cfg # deploy configuration file tutorial/ # project's Python module, you'll import your code from here __init__.py items.py ...
Read more »

bash_profile, bashrc与zshrc的区别

Posted on 2019-01-17 | | Visitors:
看教程的时候,经常能看到需要在这三个文件上读写。那么这三个文件是干什么的,以及有什么区别呢? 这三个文件都是用来设置用户工作环境的文件。它们都是终端启动时默认运行的文件。只不过他们稍有区别。 Login Shell: 输入密码进入终端的shell环境叫做Login Shell,如ssh远程登录no-Login Shell: 普通双击打开终端成为no-Login Shell, 但是在Mac中,系统都会默认给Login Shell。 bash_profile: 专门用于Login Shell里的 bashrc: 专门用于no-Login Shell里的 zshrc: 装了oh-my-zsh之后,启动时会运行zshrc而不是上面两个文件。另外它和Login Shell与no-Login Shell都没有关系,不管什么shell都会运行。
Read more »

Linux Commands

Posted on 2019-01-16 | | Visitors:
文件操作:ls -a : 显示全部文件 -l : 详情显示 组合命令 mkdir -p 参数 cd 上下级目录 rm• 删除文件• 删除文件夹• 删除当前目录下所有文件 mvcpcat 显示内容 导入文件 追加如文件 sudo 作用 command not found git clone 从github上clone一个repo到本地 进阶grep 搜索文件内容 搜索前一个命令输出 ifconfig 找到ip lsof lsof -i tcp:5000 shell 脚本编写 执行权限 服务器交互wgetscp 下载文件 scp user@ip:server_path local_path 下载目录 scp -r user@ip:server_path local_path 上传文件 scp local_path user@ip:server_path ...
Read more »

React

Posted on 2019-01-14 | | Visitors:
123$ create-react-app my-app$ cd my-app/$ npm start Deploymentnpm run build Static Server:12npm install -g serveserve -s build Integrate Bootstrap123npm install bootstrapimport "bootstrap/dist/css/bootstrap.css"; React Plugin for Visual Studio Code Simple React Snippets Prettier - Code formatter React计时器计时器要在componentDidMount生命周期方法挂上,然后在componentWillUnmount生命周期方法清除。下面是ES6(Class)的语法范例:12 ...
Read more »

Mac Plugin

Posted on 2019-01-14 | | Visitors:
Tuxera NTFS scroll reverser 系统助手 MPV播放器
Read more »

Flask

Posted on 2019-01-14 | | Visitors:
Run sever1FLASK_APP=manage.py FLASK_ENV=development flask run 项目结构1234567891011121314151617181920|- projectName |- app //程序包 |- templates //jinjia2模板 |- static //css,js 图片等静态文件 |- main //py程序包 ,可以有多个这种包,每个对应不同的功能 |- __init__.py |- errors.py |- forms.py ...
Read more »

Certificate

Posted on 2019-01-14 | | Visitors:
iOS/Mac 设备(系统)使用 App Provisioning Profile(Code Signing Identity)中的开发证书来判断App的合法性: 若用证书公钥能成功解密出 App(executable bundle)的内容摘要(_CodeSignature),证明此 App 确乃认证开发者发布,即来源可信; 再对 App(executable bundle)本身使用哈希算法计算摘要,若与上一步得到的摘要一致,则证明此 App 未被篡改过,即内容完整。 CSR: Certificate Signing RequestOnly Certificates: .p7b or .cer or .pem file If Keychain Access shows a certificate in your personal keychain, but it doesn’t sho ...
Read more »
12
Chen Xu

Chen Xu

13 posts
1 categories
1 tags
GitHub E-Mail Twitter FB Page
© 2021 Chen Xu
Powered by Hexo
|
Theme — NexT.Gemini v5.1.4