Skip to content

Instantly share code, notes, and snippets.

@lly365
lly365 / pgadmin-uwsgi.ini
Created May 12, 2018 02:39
uwsgi config file for pgadmin
[uwsgi]
chdir=/var/www/pgadmin/venv/lib/python3.6/site-packages/pgadmin4
home=/var/www/pgadmin/venv
wsgi-file=pgAdmin4.wsgi
master=true
processes=2
socket=/var/www/pgadmin/pgadmin.sock
chmod-socket=666
logfile-chmod=644
daemonize=/var/www/pgadmin/pgadmin.log
ssh -qTfnN -D 1080 [email protected] -p 22
@lly365
lly365 / LC_CTYPE.txt
Created April 26, 2018 00:49 — forked from ibrahimlawal/LC_CTYPE.txt
Centos warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory
vi /etc/environment
add these lines...
LANG=en_US.utf-8
LC_ALL=en_US.utf-8
@lly365
lly365 / siecje.py
Created April 8, 2018 05:26 — forked from doobeh/example.html
Checkbox WTForms Example (in Flask)
from flask import Flask, render_template
from flask.ext.wtf import Form, widgets, SelectMultipleField
SECRET_KEY = 'development'
app = Flask(__name__)
app.config.from_object(__name__)
class MultiCheckboxField(SelectMultipleField):
widget = widgets.ListWidget(prefix_label=False)
@lly365
lly365 / sqlalchemy_json.py
Last active April 3, 2018 10:44
sqlalchemy 处理 JSON 数据(添加、查找,聚合)
# 模型
from app import db
from sqlalchemy.dialects.postgresql import UUID, JSON
from sqlalchemy import text as sa_text
class User(db.Model):
id = db.Column(UUID(as_uuid=True), primary_key=True, default=sa_text("uuid_generate_v4()"))
username = db.Column(db.CHAR(16), unique=True, nullable=False)
profile = db.Column(JSON)
@lly365
lly365 / pg_uuid.py
Created February 7, 2018 09:37
Flask-SQLAlchemy UUID
# -*- coding: utf-8 -*-
"""
pg_uuid
~~~~~~~~~~~~~~~~
<NO DESCRIPTION>.
:copyright: (c) 2018 by WRDLL <[email protected]>
"""
from flask import Flask
@lly365
lly365 / fibonacci_closure.go
Created December 7, 2017 09:28 — forked from tetsuok/fibonacci_closure.go
An answer of the exercise: Fibonacci closure on a tour of Go
package main
import "fmt"
// Very naive answer.
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
n := 0
a := 0
@lly365
lly365 / # macvim - 2016-01-11_09-59-09.txt
Created January 11, 2016 02:08
macvim on OS X 10.11.2 - Homebrew build logs
Homebrew build logs for macvim on OS X 10.11.2
Build date: 2016-01-11 09:59:09