Skip to content

Instantly share code, notes, and snippets.

@aweffr
aweffr / user-rule.txt
Last active August 20, 2019 14:18
Custom Pac
! Put user rules line by line in this file.
! See https://adblockplus.org/en/filter-cheatsheet
||akamaihd.net
||android.com
||assets.bwbx.io
||chocolatey.org
||developer.mozilla.org
||github.com
||github.io
@aweffr
aweffr / SimpleCountUp.js
Last active November 21, 2018 02:45
简化 CountUp.js emitting data instead of update dom (with format)
// https://github.com/danro/jquery-easing/blob/master/jquery.easing.js
const easeOutExpo = (t, b, c, d) => {
return c * (-Math.pow(2, -10 * t / d) + 1) * 1024 / 1023 + b;
};
const easeInCubic = (t, b, c, d) => {
return c * (t /= d) * t * t + b;
};
const easeOutCubic = (t, b, c, d) => {
@aweffr
aweffr / System Design.md
Created February 15, 2019 09:38 — forked from vasanthk/System Design.md
System Design Cheatsheet

System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?
@aweffr
aweffr / requirements.txt
Created March 21, 2019 11:40
py37 lock package version
Package Version
-------------------- --------
absl-py 0.7.0
astor 0.7.1
backcall 0.1.0
certifi 2019.3.9
cffi 1.12.2
Click 7.0
colorama 0.4.1
decorator 4.4.0
conda create -n oa python=3.6.8 certifi==2019.3.9 pip==19.0.3 setuptools==40.8.0 wheel==0.33.1 wincertstore==0.2
@aweffr
aweffr / fix_locale.py
Last active April 10, 2019 09:12
修复中文的locale在CentOS中的问题
#!/usr/bin/env python
# encoding=utf-8
import os
new_lines = []
with open("/etc/yum.conf", "r") as f:
for line in f:
line = line.strip()
@aweffr
aweffr / run_as_admin.py
Created April 13, 2019 08:17
python: windows 提升到 admin
def run_as_admin(argv=None, debug=False):
shell32 = ctypes.windll.shell32
if argv is None and shell32.IsUserAnAdmin():
return True
if argv is None:
argv = sys.argv
if hasattr(sys, '_MEIPASS'):
# Support pyinstaller wrapped program.
arguments = list(map(str, argv[1:]))
@aweffr
aweffr / greaseMoney-starter.js
Created September 4, 2019 01:51
greaseMoney-starter.js
// ==UserScript==
// @name test
// @namespace http://tampermonkey.net/
// @version 0.1
// @description test
// @match *
// @author rxliuli
// @grant MIT
// @grant GM.deleteValue
// @grant GM.getValue
npm set registry https://r.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
## 以下选择添加
npm set sass_binary_site https://npm.taobao.org/mirrors/node-sass # node-sass 二进制包镜像
npm set electron_mirror https://npm.taobao.org/mirrors/electron/ # electron 二进制包镜像
npm set puppeteer_download_host https://npm.taobao.org/mirrors # puppeteer 二进制包镜像
npm set chromedriver_cdnurl https://npm.taobao.org/mirrors/chromedriver # chromedriver 二进制包镜像
npm set operadriver_cdnurl https://npm.taobao.org/mirrors/operadriver # operadriver 二进制包镜像
npm set phantomjs_cdnurl https://npm.taobao.org/mirrors/phantomjs # phantomjs 二进制包镜像
@aweffr
aweffr / centos6-mime.types
Last active September 27, 2019 10:40
常用mime-types参考
# This is a comment. I love comments. -*- indent-tabs-mode: t -*-
# This file controls what Internet media types are sent to the client for
# given file extension(s). Sending the correct media type to the client
# is important so they know how to handle the content of the file.
# Extra types can either be added here or by using an AddType directive
# in your config files. For more information about Internet media types,
# please read RFC 2045, 2046, 2047, 2048, and 2077. The Internet media type
# registry is at <http://www.iana.org/assignments/media-types/>.