This file contains 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
<?php | |
/** | |
* 生成验证码 | |
* @author chenzhouyu | |
* 类用法 | |
* $checkcode = new checkcode(); | |
* $checkcode->doimage(); | |
* //取得验证 | |
* $_SESSION['code']=$checkcode->get_code(); | |
*/ |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> | |
<style> | |
h1 { | |
width: 1em; | |
font-size: 40px; |
This file contains 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
['一,''二,''三,''四,''五,''六,''日'] |
This file contains 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
try: | |
{ | |
'a': do_a, | |
'b': do_b, | |
'c': do_c | |
}[key](x) | |
except KeyError: | |
do_default |
This file contains 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
nestingLimit=30 | |
def getFolders(file_path): | |
if file_path is None: | |
return [] | |
folders = [file_path] | |
limit = nestingLimit | |
while True: | |
split = os.path.split(file_path) |
This file contains 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
# Finds a real file path among given folder paths | |
# and returns the path or None | |
# | |
# @type folders: list<string> | |
# @param folders: list of paths to folders to look into | |
# @type file_name: string | |
# @param file_name: file name to search | |
# | |
# @return string file path or None | |
def findFile(folders, file_name): |
This file contains 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 os,time | |
import threading | |
rlock = threading.RLock() | |
curPosition = 0 | |
class Reader(threading.Thread): | |
def __init__(self, res): | |
self.res = res |
This file contains 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 wmi | |
import time | |
c = wmi.WMI() | |
while True: | |
for cpu in c.Win32_Processor(): | |
timestamp = time.strftime('%a, %d %b %Y %H:%M:%S', time.localtime()) | |
print '%s | Utilization: %s: %d %%' % (timestamp, cpu.DeviceID, cpu.LoadPercentage) |
This file contains 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
import locale | |
import codecs | |
print locale.getpreferredencoding(); | |
print codecs.lookup(locale.getpreferredencoding()).name |
OlderNewer