Skip to content

Instantly share code, notes, and snippets.

@345161974
345161974 / qtableview_demo.py
Created February 28, 2017 08:31
PyQt QTableView with CheckBox and Model Update demo code(PyQt 4.8.7, Python 3.4.3)
''' pqt_tableview3.py
explore PyQT's QTableView Model
using QAbstractTableModel to present tabular data
allow table sorting by clicking on the header title
used the Anaconda package (comes with PyQt4) on OS X
(dns)
'''
#coding=utf-8
@jpzhu
jpzhu / lunch.md
Last active August 29, 2015 14:02
build lunch

lunch脚本做了些什么

从LUNCH_MENU_CHOICES列表从选择一项产品作为编译目标

这个没有什么好介绍的,将选中的内容以“-”号部分作为分隔符,分别赋给两个变量.

前面部分叫product,也就是要编译什么

local product=$(echo -n $selection | sed -e "s/-.*$//")

后面部分叫variant,编一个什么版本 >local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//")

@SaitoWu
SaitoWu / linner.yml
Last active December 29, 2015 19:10
Linner configuration example.
paths:
app: "src"
public: "public"
groups:
scripts:
paths:
- "src/scripts"
concat:
"/pokeball.js": "{src,vendor}/**/*.{js,coffee}"
order:
@ChickenProp
ChickenProp / gist:3183960
Created July 26, 2012 19:21
Expanding the Raspberry Pi's GPIO capabilities with the MCP23017

Introduction

The MCP23017 is an I/O expander chip. It has 16 GPIO pins which you can control using an I2C interface using two pins from a Raspberry Pi, plus a power source and sink (which can also come from the Pi). It's not quite as simple as directly controlling the Pi's GPIO pins, but it's not complicated, either.

You need to install i2c-tools, which is probably in your distribution's package manager. You also need a kernel with I2C support; you might need to modprobe i2c-dev. It would presumably be possible to do without either of these things, and bitbang the I2C protocol over GPIO, but I don't understand the protocol well enough to try.

On pin numbering: if you like, you can refer to the datasheet for the MCP23017. There's a small dot in one corner of the chip, with a semi-circular cut-out at that end. The pin near

@myrual
myrual / gist:1867470
Created February 20, 2012 02:58
傅立叶变换
短周期分析最后的话
短周期,无论是外围结构还是内部结构,都很难对实际的走势有明确的,固定的,可重复的影响,并作为判断依据提炼出来的,使用的方法更多的是概率,指标类的东西。
傅立叶变化,可以求解所有的曲线,并可以无限的拟合数据。这从另一个角度说明了,就算有确定的方程,微小初始变量的变化,是作为谐波或小波变化,还是无限拟合下去?答案只有两个,证明了股市的混沌(当然不否认奇异吸引子的存在),另一个就是在小波变化和杂波里面艰苦的挣扎。
如果不考量实际的傅立叶变化结果,只考量傅立叶波动的特性,特别是求解某一阶的傅立叶变换,那么固定的f(x)有着良好的可预测性,就算加上小波和杂波,还是有着优良的预测能力
频谱分析+傅立叶变换+成交密集足以+顺势指标足以!
第一、复杂事物目标矢量化,限制各适量范围,并求解最优值
第二、复杂事物内寻求变量,并按结构分别对矢量进行模型化
第三、变量按照阻力最小的原则在事物内部结构内正常流动
@victoroliv2
victoroliv2 / cross-site-xmlhttprequest.py
Created October 7, 2011 19:09
web.py server which allow cross-site xmlhttprequest
import web
urls = (
'/(.*)', 'Service'
)
app = web.application(urls, globals())
class Service:
def GET(self, name):
web.header('Access-Control-Allow-Origin', '*')
@jonleighton
jonleighton / base64ArrayBuffer.js
Last active January 3, 2024 11:59
Encode an ArrayBuffer as a base64 string
// Converts an ArrayBuffer directly to base64, without any intermediate 'convert to string then
// use window.btoa' step. According to my tests, this appears to be a faster approach:
// http://jsperf.com/encoding-xhr-image-data/5
/*
MIT LICENSE
Copyright 2011 Jon Leighton
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
@myrual
myrual / 记录被抽的记录
Created November 26, 2010 14:57
亡羊补牢,温故知新
记录一下,是不是真的黄金大牛市没完。
http://video.caixin.cn/2011-09-30/100310959.html601377
2011 Nov 22
几天来,一直滚啊滚。
外盘很差,但是今天似乎有放缓的迹象。
基本印象:都缩量。保险收红第二天,然后是其他的。1857今天震荡。
从10.25日到现在,
计算机 9.0 电力设备 8.0 教育传媒 8.0 云计算 8.0 创业板 8.0
从11.4号到现在