This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################### | |
开发步骤 | |
Sublime text 2 的插件开发使用的是 Python 。具体接口可以参考 API Reference。而 How to Create a Sublime Text 2 Plugin 提供了一个很好插件开发例子。 | |
使用插件模板 | |
使用 Sublime 菜单 Tools->New Plugin... ,即可创建新的插件: | |
import sublime, sublime_plugin | |
class ExampleCommand(sublime_plugin.TextCommand): | |
def run(self, edit): | |
self.view.insert(edit, 0, "Hello, World!") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding:utf-8 | |
""" | |
Python-Sqlite3数据库操作 | |
自定义数据类型存储 | |
""" | |
import sqlite3 | |
try: | |
import cPickle as pickle | |
except : | |
import pickle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//////////////////////////////////////////////////////////////////////////////// | |
//串行数据总线协议IIC | |
//////////////////////////////////////////////////////////////////////////////// | |
`timescale 1ns/1ns | |
module i2c_wr (clk,rst_n,wr,rd,addr,data_w,data_r,ack,scl,sda); | |
input clk; //clock | |
input rst_n; //reset | |
input wr,rd; //write,read command | |
input [10:0] addr; //write,read eeprom address |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding=utf-8 | |
import time | |
import sched | |
import os | |
import threading | |
""" | |
sched模块,准确的说,它是一个调度(延时处理机制),每次想要定时执行某任务都必须写入一个调度。 | |
使用步骤如下: | |
(1)生成调度器: | |
s = sched.scheduler(time.time,time.sleep) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding:utf-8 | |
""" | |
实现python操作cmd | |
以及与windows系统交互 | |
""" | |
import os, sys, subprocess | |
def pyCmd(cmd): | |
cmd = 'dir' | |
os.system(cmd) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding=utf-8 | |
import threading, Queue | |
import time, random | |
""" | |
线程,队列同步运用 | |
""" | |
############## | |
# Producer thread | |
############## | |
class Producer(threading.Thread): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding:utf-8 | |
########################################### | |
#生命很短暂,精简就是生命 | |
########################################### | |
#交换变量避免使用临时变量 | |
######################### | |
#M1 | |
temp = x | |
x = y | |
y = temp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding:utf-8 | |
############################# | |
#装饰器:在函数体前后插入执行代码,并完成封装 | |
#利用装饰器函数实现对函数跟踪 | |
#添加装饰器实现Debug调试 | |
#/////////////////////////////////////////////////////////// | |
#from Decorater import trace_func as trace | |
#/////////////////////////////////////////////////////////// | |
import profile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Verilog硬件设计最高境界:胸中有沟壑,清晰明白每一条语句所代表硬件电路 | |
`timescale 1ns/100ps //0.1ns is allowed | |
module gray_counter(d_in, | |
clk, | |
rst, | |
ld, | |
q | |
); | |
//input and output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding:utf-8 | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf8') | |
import random | |
import math | |
from pyneurgen.neuralnet import NeuralNet | |
from pyneurgen.nodes import BiasNode, Connection |
NewerOlder