Skip to content

Instantly share code, notes, and snippets.

@phyng
phyng / ubuntu-server-start.md
Created January 17, 2020 16:53
Ubuntu Server Start

Ubuntu Server Start

login as root

# base
apt update
apt upgrade
apt install wget curl git vim htop tree byobu zsh
ALTER TABLE order_orderitem ADD company_id int;
CREATE INDEX order_orderitem_company_id ON order_orderitem USING btree (company_id);
ALTER TABLE ONLY order_orderitem
ADD CONSTRAINT company_id_refs_id_4459ffbd FOREIGN KEY (company_id) REFERENCES company_company(id) DEFERRABLE INITIALLY DEFERRED;
@phyng
phyng / area.js
Created May 31, 2017 10:41
area.js
/*
地址选择组件
*/
window.Djs = window.Djs || {}
Djs.Area = {
promise: null,
data: [],
data_map: {}
@phyng
phyng / deploy.sh
Created January 26, 2017 15:22
Deploying a subfolder to GitHub Pages
# subfolder: dist
# ref: https://gist.github.com/cobyism/4730490
# save the last commit id
old_commit=$(git log -1 --pretty=format:"%h")
# force add dist and commit
git add dist -f && git commit -m "build: build prod"
@phyng
phyng / keybase.md
Created August 30, 2016 01:00
keybase.md

Keybase proof

I hereby claim:

  • I am phyng on github.
  • I am phyng (https://keybase.io/phyng) on keybase.
  • I have a public key whose fingerprint is 31E7 1639 C374 3CD2 5100 4975 7F4C B647 8FE4 854E

To claim this, I am signing this object:

@phyng
phyng / if_as.py
Created May 26, 2015 08:18
if_as.py
before:
something = get_something()
if something:
do_something(something)
after:
if get_something() as something:
do_something(something)

SED单行脚本快速参考(Unix 流编辑器) 2005年12月29日

英文标题:USEFUL ONE-LINE SCRIPTS FOR SED (Unix stream editor) 原标题:HANDY ONE-LINERS FOR SED (Unix stream editor)

整理:Eric Pement - 电邮:pemente[at]northpark[dot]edu 版本5.5 译者:Joe Hong - 电邮:hq00e[at]126[dot]com

在以下地址可找到本文档的最新(英文)版本:

@phyng
phyng / python_resources.md
Last active August 29, 2015 14:07 — forked from jookyboi/python_resources.md
Python-related modules and guides.

Packages

  • lxml - Pythonic binding for the C libraries libxml2 and libxslt.
  • boto - Python interface to Amazon Web Services
  • Django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
  • Fabric - Library and command-line tool for streamlining the use of SSH for application deployment or systems administration task.
  • PyMongo - Tools for working with MongoDB, and is the recommended way to work with MongoDB from Python.
  • Celery - Task queue to distribute work across threads or machines.
  • pytz - pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher.

Guides

@phyng
phyng / 0_reuse_code.js
Last active August 29, 2015 14:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console