Skip to content

Instantly share code, notes, and snippets.

@aweffr
aweffr / .gitlab-ci.yml
Created May 25, 2022 07:24 — forked from zerda/.gitlab-ci.yml
Gitlab CI for front-end project
image: node:6-alpine
cache:
key: "$CI_PROJECT_NAMESPACE/$CI_PROJECT_NAME"
paths:
- node_modules/
- yarn_cache/
stages:
- setup
@aweffr
aweffr / index.js
Created April 3, 2022 08:52 — forked from davx1992/index.js
/** UI element heights which used in message height calculation */
textPaddingVertical: number = 7;
textPaddingHorizontal: number = 10;
timeHeight: number = 12;
timeTopMargin: number = 5;
messageContainerVerticalMargin: number = 7;
dateSeperatorVerticalMargin: number = 20;
dateSeperatorHeight: number = 15;
imageHeight: number = 170;
imageBottomMargin: number = 10;
# rename.py
# usage: python3 rename.py ~/pics
import sys
from pathlib import Path
def print_usage():
print('usage: python3 rename.py [target-dir]', file=sys.stderr)
"""
Mac 喝水提示
crontab -e
*/30 8-22/1 * * * [your python] [script path]
- 8点到20点每半小时提示一次喝水
"""
@aweffr
aweffr / nginx.conf
Created April 29, 2021 01:35 — forked from fotock/nginx.conf
Nginx SSL 安全配置最佳实践.
# 生成 dhparam.pem 文件, 在命令行执行任一方法:
# 方法1: 很慢
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
# 方法2: 较快
# 与方法1无明显区别. 2048位也足够用, 4096更强
openssl dhparam -dsaparam -out /etc/nginx/ssl/dhparam.pem 4096
@aweffr
aweffr / formik-mobx.js
Created March 12, 2021 06:02 — forked from danielkcz/formik-mobx.js
Formik with MobX
function useFormik(props) {
// useState to keep the same observable around without recreating it on each render
const [formik] = React.useState(() =>
mobx.observable({
values: props.initialValues || {},
touched: {}
})
)
// just mutate state, this function itself can be considered an action+reducer
@aweffr
aweffr / fonts.xml
Created November 20, 2020 08:36
MIUI 12 字体列表
<?xml version="1.0" encoding="utf-8"?>
<!--
WARNING: Parsing of this file by third-party apps is not supported. The
file, and the font files it refers to, will be renamed and/or moved out
from their respective location in the next Android release, and/or the
format or syntax of the file may change significantly. If you parse this
file for information about system fonts, do it at your own risk. Your
application will almost certainly break with the next major Android
release.
@aweffr
aweffr / rm-xcode-deriveddata.sh
Created November 3, 2020 02:28
rm Xcode DerivedData
rm -rf $HOME/Library/Developer/Xcode/DerivedData/*
@aweffr
aweffr / inject_params.py
Created September 30, 2020 08:15
flask 装饰器: 自动把 query / body 里的参数转到 view_function 声明的参数里
from functools import wraps
import inspect
from inspect import Parameter
from flask import Flask, request, jsonify
from typing import Optional
# noinspection PyUnresolvedReferences,PyProtectedMember
empty = inspect._empty
@aweffr
aweffr / jisti-install.md
Created September 18, 2020 06:58
如何安装jisti

Install lua and dependencies

Enter in sudo user

sudo su