Skip to content

Instantly share code, notes, and snippets.

@luw2007
luw2007 / README.md
Created January 26, 2015 03:05
python loads javascript sparse-array like [,0]

python中如何加载js中的稀疏数组

想要实现以下功能

>>> json.loads('[,0]')
[None, 0

原因

一直在linux 下用 translate-shell, 翻译中会附带上同义词. 但是win下没有好的支持. 找了一些类似调用google translate的实现. 但是都只是拿到翻译后的内容. 并不对同义词,反义词处理. 我猜想主要的原因是translate.google.com(国内可以访问.cn)返回的是js 的对象. 对比json会发现其中存在'[,,]'.

@luw2007
luw2007 / mynote.xml
Last active August 29, 2015 14:13 — forked from xiaoganghan/mynote.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export2.dtd">
<en-export export-date="20120727T073610Z" application="Evernote" version="Evernote Mac 3.0.5 (209942)">
<note><title>Vim Tips</title><content><![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd">
<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">
yank for copy, delete for cut, put for parse
<div><br/></div>
<div>Move in context, not position</div>
<div>/ search forward</div>
@luw2007
luw2007 / pyuno_in_ubuntu_14.md
Created January 16, 2015 09:07
Python 2.7 with pyuno in ubuntu

##ubuntu 13.10 and later , you need to install openoffice 4.1.1

###1. uninstall libreoffice and openoffice

sudo apt-get remove libreoffice* openoffice*
sudo apt-get autoremove

###2. install Apache OpenOffice 4.1.1 on 64 bit Ubuntu

wget sourceforge.net/projects/openofficeorg.mirror/files/4.1.1/binaries/en-GB/Apache_OpenOffice_4.1.1_Linux_x86-64_install-deb_en-GB.tar.gz

@luw2007
luw2007 / Mongo_AutoReference.ipynb
Last active August 29, 2015 14:13
介绍mongodb auto reference , 在线访问 http://nbviewer.ipython.org/2dbc60ce26507ad74606
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@luw2007
luw2007 / md.md
Created September 18, 2014 06:31
科技树

#科技树 ##编程语言:

  • 常用 c/c++ -> VB/.NET -> SQL -> SH -> python -> javascript|html|css -> golang
  • 熟悉 pascal/matlab/lua/qml

##版本管理: cvs -> svn -> git

##开发工具: 包管理 pip wheel

@luw2007
luw2007 / README.md
Last active August 29, 2015 13:56
西藏日历 2008-2015

#西藏日历 2008-2015

目的

项目中需要能够生成藏历, 但是藏历并不像农历那样, 有特定的规则. 而且也没有对照表. 网上可以查询到的基本都是当年或者往年的日历, 因此只能每年更新.

例子

>>> from datetime import datetime
>>> zl = ZLCalendar(datetime(2013,10,15))

>>> print zl.zldate

@luw2007
luw2007 / matplotlib_ttc.md
Last active April 10, 2025 15:24
matplotlib 支持 ttc . 原理为修改matplotlib 的 字体查找函数, 让其可以查找ttc 字体.

#matplotlib 支持 ttc ttc 是 microsoft 的标准, 还是建议使用 ttctools 分解 ttc 为多个ttf . 然后拷贝ttf 到字体目录(/usr/share/fonts/truetype)

grep Wen ~/.cache/matplotlib/fontList.cache
S'WenQuanYi Micro Hei'

以下为hack方法, 不建议使用

matplotlib 1.3.1 版本中默认不使用ttc 字体, hack matplotlib的字体查找方法, 使其可以使用ttc 字体. ##安装字体

diff --git a/pprint.py b/pprint.py
--- a/pprint.py
+++ b/pprint.py
@@ -36,6 +36,7 @@ saferepr()
import sys as _sys
import warnings
+import locale
from cStringIO import StringIO as _StringIO
@luw2007
luw2007 / ds_796
Created October 10, 2013 08:19
ds_796 连
2013-10-10 15:24:21,461 - 282: 得到 一张3星卡 特异型黑沃尔
2013-10-10 15:24:36,321 - 282: 得到 一张3星卡 特异型圣日耳曼
2013-10-10 15:24:36,872 - 282: 得到 一张4星卡 第二型加雷斯
2013-10-10 15:24:37,459 - 282: 得到 一张4星卡 支援型甜心
2013-10-10 15:24:38,042 - 282: 得到 一张4星卡 特异型猎户座
2013-10-10 15:24:38,632 - 282: 得到 一张3星卡 特异型白雪公主
2013-10-10 15:24:39,207 - 282: 得到 一张4星卡 支援型提妮亚
2013-10-10 15:24:39,832 - 282: 得到 一张4星卡 复原型乌瑟
2013-10-10 15:24:40,420 - 282: 得到 一张5星卡 幻兽型月兔
2013-10-10 15:24:41,039 - 282: 得到 一张3星卡 支援型兰克
@luw2007
luw2007 / requiretment.md
Created September 16, 2013 08:03
requiretment.md

#需求分析

##探索

  • 自动探索,每日密境 > 活动密境 > 固定密境
  • 计算升级时间

##妖精战

  • 舔妖
  • 计算是否秒掉
  • 吃BC 秒觉醒