Skip to content

Instantly share code, notes, and snippets.

@keysona
keysona / Mac_free_mem.sh
Created June 21, 2018 12:07
Mac free memory
#!/bin/bash
# 需要用root用户来安装crontab任务
# $ sudo su -
# # crontab -e
# 复制这个: */1 * * * * /Users/keysona/OneDrive/bin/free_mem.sh
# */1 代表每分钟执行一次脚本
limit=500 # 小于500MB,自动清理内存
mem=$(top -l 1 | head -n 10 | grep PhysMem | cut -f6 -d ' ' | cut -f1 -d 'M')
4 thread and 400 connections in 30 seconds
aiohttp - no uvloop
Running 30s test @ http://127.0.0.1:8000
4 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 73.50ms 9.94ms 370.71ms 81.79%
Req/Sec 1.36k 339.69 2.71k 56.10%
161299 requests in 30.03s, 23.84MB read
Requests/sec: 5371.45
@keysona
keysona / 城市名与id.xml
Created March 1, 2017 09:44
城市名与id
<?xml version="1.0" encoding="UTF-8"?>
<China>
<province id="01" name="北京">
<city id="0101" name="北京">
<county id="010101" name="北京" weatherCode="101010100"/>
<county id="010102" name="海淀" weatherCode="101010200"/>
<county id="010103" name="朝阳" weatherCode="101010300"/>
<county id="010104" name="顺义" weatherCode="101010400"/>
<county id="010105" name="怀柔" weatherCode="101010500"/>
@keysona
keysona / gist:9b34605ef36cd2e5cc649b44f5c494f7
Created February 20, 2017 06:21
启动一个字符编码为utf8的mysql容器(docker)
docker run --name mysql -e MYSQL_ROOT_PASSWORD=dg123321 -e MYSQL_DATABASE=blog -v /data/blog:/var/lib/mysql -v /config/mysql:/etc/mysql/conf.d -d mysql:5.7 --character-set-server=utf8 --collation-server=utf8_general_ci
@keysona
keysona / 大学.json
Last active August 3, 2020 06:28
中国大学名单
{
"湖南省": [
"湘潭大学",
"吉首大学",
"湖南大学",
"中南大学",
"湖南科技大学",
"长沙理工大学",
"湖南农业大学",
"中南林业科技大学",
@keysona
keysona / gist:3a4f32fdb0ee1b4fe2fab7e37c309756
Created December 1, 2016 08:21
python3 缓存的整数范围
-256 ~ 256
@keysona
keysona / md
Created November 18, 2016 02:12
## How CSS works
- **HTML**, document's content.
- **CSS** (Cascading Style Sheets), document's style.
- **DOM** (Document Object Model), tree-like structure, formed from DOM node, combines the document's content with its style in memory.
- *Markup language*: HTML, SVG, XML.
- **CSS Rule** formed from: properties & selector.
- CSS use: external stylesheet (```<link>```), internal stylesheet (```<style>```), inline styles.
![work](https://mdn.mozillademos.org/files/11781/rendering.svg)
@keysona
keysona / gist:9515cbcc365b7708c34b3d64d946ea23
Created October 18, 2016 12:58
Ionic2-Slides-创造图片滑动栏
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
@Component({
selector: 'page-component',
templateUrl: `
<ion-header>
<ion-navbar>
<ion-title text-center>
edit ~/.npmrc
add "http_proxy=http://127.0.0.1:9527"
@keysona
keysona / gist:5131ce856c770a9b262a
Last active January 2, 2016 08:28
JAR包不应该包含main方法,同时删掉没用用的包
不然在android studio引用时,会报运行时错误:返回值不是0,而是1.
eclipse 要删掉没有用到的包,不然在android studio也会出现同样的问题.