Skip to content

Instantly share code, notes, and snippets.

View qloog's full-sized avatar
🤒
Out sick

Richard qloog

🤒
Out sick
  • Beijing, China
View GitHub Profile
@qloog
qloog / go.vim
Created March 24, 2022 06:30 — forked from MarioCarrion/go.vim
Nvim Go configuration
"-- vim-go specific configuration
" run :GoBuild or :GoTestCompile based on the go file
function! s:build_go_files()
let l:file = expand('%')
if l:file =~# '^\f\+_test\.go$'
call go#test#Test(0, 1)
elseif l:file =~# '^\f\+\.go$'
call go#cmd#Build(0)
endif
@qloog
qloog / init.vim
Created March 10, 2022 02:14 — forked from MarioCarrion/init.vim
Basic nvim configuration
let mapleader = ","
filetype on
filetype indent on
filetype plugin on
set encoding=UTF-8
syntax on
set nocompatible
@qloog
qloog / producer.go
Created April 9, 2021 11:00 — forked from ms2008/producer.go
rabbitmq producer
package rabbitmq
import (
"log"
"time"
"github.com/pborman/uuid"
"github.com/streadway/amqp"
)
#############################################################################
# current prompt
#############################################################################
# \d – Current date
# \t – Current time
# \h – Host name
# \# – Command number
# \u – User name
# \W – Current working directory (ie: Desktop/)
# \w – Current working directory, full path (ie: /Users/Admin/Desktop)
@qloog
qloog / Installing Haskell and Cabal on CentOS 5.4.md
Last active August 29, 2015 14:01
Installing Haskell and Cabal on CentOS 5.4.md

Adopted from this post

Install libedit

sudo yum install libtermcap-devel
export LIBEDIT_VERSION=0.3
curl -LOk http://jaist.dl.sourceforge.net/sourceforge/libedit/libedit-$LIBEDIT_VERSION.tar.gz
tar -zxf libedit-0.3.tar.gz
cd libedit

CFLAGS='-g -O2 -fPIC' ./configure --prefix=/usr

"""
http://saepy.sinaapp.com/topic/24/Tornado%E4%B8%8A%E4%BC%A0%E6%96%87%E4%BB%B6%E7%A4%BA%E4%BE%8B
在bcore的开发过程中涉及到上传文件有两个地方一个是相册一个是文章图文混排这里作为一个备忘罗列一些关键点
文件上传的内容体在tornado.web.RequestHandler.request.files属性中并且是以数组形式存放的
使用临时文件存储时在write完成后要记着把seek重置到文件头要不然文件无法被读取
再使用Image模块的thumbnail方法进行缩放时,resample=1作为重载渲染参数能够有效的使图片平滑消除锯齿