Skip to content

Instantly share code, notes, and snippets.

View TheWaWaR's full-sized avatar
🌀
Focusing

LingFeng TheWaWaR

🌀
Focusing
View GitHub Profile
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
app.debug = True
@app.route('/')
def index():
return render_template('index.html')
@TheWaWaR
TheWaWaR / Install-rtorrent.sh
Last active December 30, 2015 16:09
Install Linux Command Line BitTorrent client in CentOS 6.4.
# 1. Install the dependencies
yum install gcc-c++ libsigc++20-devel
# 2. Install libTorrent
wget http://libtorrent.rakshasa.no/downloads/libtorrent-0.13.3.tar.gz
./configure --prefix=$HOME/local && make && make install
# 3. Install the client
wget http://libtorrent.rakshasa.no/downloads/rtorrent-0.9.3.tar.gz
export PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig
@TheWaWaR
TheWaWaR / install_jdk7.sh
Last active December 24, 2015 18:09 — forked from ralph-tice/gist:4252866
Install JDK7 in Linux.
#download the JDK
#oracle's rpm.bin gets pulled down as corrupt..zzz
#wget --no-cookies --header "Cookie: gpw_e24=xxx" "http://download.oracle.com/otn-pub/java/jdk/7/jdk-7-linux-x64-rpm.bin" -O jdk-7-linux-x64-rpm.bin
#updated for version 7u11
wget --no-check-certificate --no-cookies --header "Cookie: gpw_e24=xxx" http://download.oracle.com/otn-pub/java/jdk/7u11-b21/jdk-7u11-linux-x64.rpm -O jdk-7u11-linux-x64.rpm
sudo rpm -ivh jdk-7u11-linux-x64.rpm
sudo alternatives --install /usr/bin/java java /usr/java/default/bin/java 20000
@TheWaWaR
TheWaWaR / nested_list.qml
Last active December 21, 2015 00:38 — forked from elpuri/gist:3753756
A collapsible nested list example in QML
import QtQuick 1.1
Item {
width: 200
height: 300
ListView {
anchors.fill: parent
model: nestedModel
delegate: categoryDelegate
@TheWaWaR
TheWaWaR / upload-as-static-folder.py
Last active December 19, 2015 04:39 — forked from rduplain/app.py
Add *upload* folder as static file folder.
import os
from flask import Flask, send_from_directory
app = Flask(__name__)
@app.route('/upload/<path:filename>')
def send_uploads(filename):
print filename
return send_from_directory(os.path.join(app.root_path, 'upload'), filename)
@TheWaWaR
TheWaWaR / tmux.conf
Last active April 21, 2016 14:22
My tmux config file
# Created at: [2013-04-28 10:00]
# Updated at: [2015-11-26 10:39]
# Updated at: [2016-01-29 23:51]
set -g utf8
set-window-option -g utf8 on
# Common
set -g mode-keys vi
set-option -g default-shell $TMUX_SHELL # In ~/.bashrc :: export TMUX_SHELL='/usr/local/bin/zsh'
@TheWaWaR
TheWaWaR / install-cx_Oracle.sh
Created June 14, 2013 02:03
在 CentOS 上安装 cx_Oracle
# 从 Oracle 官方网站下载下列文件:
#
# oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
# oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm
# oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
# 安装 Oracle 客户端
rpm -ivh oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
rpm -ivh oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm
@TheWaWaR
TheWaWaR / Emacs-info-info.md
Last active December 16, 2015 00:59
<Emacs Info Info> Document Reading Note

Concepts

  • Node : A content section
  • Menu : List subnodes
  • Cross-Reference : Link to some node
  • Index : um...index.
  • Table of Contents : Show node hierarchy
  • History : Just like borwser page history
  • Recents : A list show recent visited nodes
@TheWaWaR
TheWaWaR / Qt-Threading-Basics.md
Last active December 15, 2015 23:49
<Qt Threading Basics> Document Reading Note

What are threads

Blabla... thread is tiny process that share the memory.

  • Thread can run on multicore CPUs. But how about The C10K problem?

GUI Thread and Worker Thread

  • Qt GUI must run in "main thread"

Simultaneous Access to Data

  • Simultaneous access an shared object will be faster that communicate in process, but it's also dangerous.
  • Some cases will cause danger
@TheWaWaR
TheWaWaR / LazyTableImages.md
Last active December 15, 2015 23:49
iOS一个动态加载数据到UITableView的源代码例子阅读笔记。

概述

应用程序代理类设置顶层视图控制,并处理了获取RSS信息(XML格式)的连接。RSS信息获取完毕后,使用了任务队列执行xml解析操作。等解析完成后将记录数据添加到记录数组中并刷新顶层视图。 顶层视图控制器控制显示记录数据,并在渲染可见元素时(满足一定条件)下载(默认异步)相应记录中的图片,然后显示出来。

  • 语境说明
    • 应用程序代理类:LazyTableAppDelegate
    • 顶层视图控制器:RootViewController
    • 负责解析XML的类:ParseOperation
    • 负责下载图片的类:IconDownloader