Skip to content

Instantly share code, notes, and snippets.

@oucb
oucb / flask_dump_request_response.py
Created October 29, 2019 09:10 — forked from TheWaWaR/flask_dump_request_response.py
Flask dump request and response example
#!/usr/bin/env python
# coding: utf-8
import os
import sys
import json
import uuid
import tempfile
from flask import Flask, request, Response, g
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@oucb
oucb / supervisord.service
Created November 14, 2018 03:24 — forked from mozillazg/supervisord.service
install and configure supervisord on centos 7.
[Unit]
Description=supervisord - Supervisor process control system for UNIX
Documentation=http://supervisord.org
After=network.target
[Service]
Type=forking
ExecStart=/bin/supervisord -c /etc/supervisord/supervisord.conf
ExecReload=/bin/supervisorctl reload
ExecStop=/bin/supervisorctl shutdown
@oucb
oucb / gotibet_list
Created November 1, 2018 09:59 — forked from ahappyforest/gotibet_list
滇藏线骑行的一些装备, 大家可以补充, 可以根据自己的需要进行选择, 这里列出了一个总的清单!
车子相关:
头盔
驼包
货架
补胎工具
水杯
内胎
码表
V刹皮
强光手电筒(18650电池也要带几块备用)
@oucb
oucb / spacemacs global search and replace.md
Created September 13, 2018 07:15 — forked from ivar/spacemacs global search and replace.md
spacemacs - global search and replace

There's a couple of ways, one way is

  • Get search results
    • Do SPC / and type in your search string
    • or SPC x S and search string - where x is your scope indicator (p for project, d for directory, etc..)
  • Once you have the occurences you want, hit C-c C-e inside the helm buffer to put all your match occurences and puts them into a special buffer called the edit buffer or something like that
  • in that buffer you can use any commands you'd normally use on a buffer
  • the C-c C-c to commit your changes.
@oucb
oucb / effective-graphql-and-antd.md
Created September 13, 2018 01:06
Effective GraphQL + Antd

高效的 GraphQL + Antd

本文原载于我的独立博客 https://lutaonan.com/blog/effective-graphql-and-antd/

在过去的几年,不论是面向内部的系统,还是面向外部的产品,我们都大量地使用了 Ant.Design —— 一个基于 React 的 UI 组件库。

在做内部系统时,Ant.Design 解决了几乎 60% 的问题。剩下的问题在业务逻辑和代码组织的复杂度。我见过很多内部系统因为滥用状态管理而使代码变得复杂,他们之所以使用状态管理库,并不是因为应用的状态复杂,而是因为需要一个状态树来管理网络请求的状态、接口返回的数据等等这些和接口相关的状态。

真的需要状态管理库吗?在之前,我没有信心回答这个问题。但在使用了 GraphQL (Apollo) 后,我确信,在大多数场景,你不再需要状态管理。

@oucb
oucb / partition.py
Created August 30, 2018 01:11 — forked from zhoubaozhou/partition.py
sqlalchemy分表测试代码
#-!-coding:utf-8-!-
# schema
# revision identifiers, used by Alembic.
revision = '507c3af35680'
down_revision = None
from alembic import op
import sqlalchemy as sa
@oucb
oucb / run_forever.py
Created August 4, 2018 03:39 — forked from syfun/run_forever.py
python3 asyncio correctry interrupt.
import asyncio
async def task():
while True:
print('Do something.')
await asyncio.sleep(1)
async def run(lp):