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
+ (NSString*)numberToChineseUppercase:(double)num{ | |
int iLen,iNum,iAddZero=0; | |
NSMutableString *szChMoney = [[NSMutableString alloc] init]; | |
NSArray *hzUnit = @[@"分",@"角",@"元",@"拾",@"佰",@"仟",@"万",@"拾",@"佰",@"仟",@"万",@"亿",@"拾",@"佰",@"仟",@"万",@"拾",@"佰",@"仟"]; | |
NSArray *hzNum = @[@"零",@"壹",@"贰",@"叁",@"肆",@"伍",@"陆",@"柒",@"捌",@"玖"]; | |
NSString *szNum = [NSString stringWithFormat:@"%18.0f",num*100]; | |
szNum = [szNum stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; | |
iLen =(int) szNum.length; | |
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
#!/bin/bash | |
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/ | |
yum groupinstall "Development tools" | |
yum install zlib-devel | |
yum install bzip2-devel openssl-devel ncurses-devel | |
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2 | |
tar xf Python-2.7.3.tar.bz2 | |
cd Python-2.7.3 |
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
// can be run in go 1.0.3 | |
// build : go build netfwd.go | |
package main | |
import ( | |
"net" | |
"fmt" | |
"io" | |
"os" | |
) |
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
""" | |
An attempt to make a safe evaluator of a subset of Python expressions. | |
This is mostly a proof-of-concept for getting feedback, it has not been | |
thoroughly checked for safety, use at your own risk :) | |
It uses the Python ast module to parse the expression, but all evaluation is | |
done by walking the ast, it is not directly executed by the Python runtime. | |
Nosetests are provided below including coverage of supported and unsupported |
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
package main | |
import ( | |
"net" | |
"fmt" | |
"io" | |
"os" | |
) | |
func main() { | |
if len(os.Args) != 3 { | |
fatal("usage: netfwd local remote") |
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
#!/usr/bin/env bash | |
# 免翻墙安装Go tools | |
branch="release-branch.go1.4" | |
mkdir -p $GOPATH/src/golang.org/x | |
git clone -b $branch git@github.com:golang/tools.git $GOPATH/src/golang.org/x/tools | |
git clone git@github.com:golang/net.git $GOPATH/src/golang.org/x/net | |
cd $GOPATH | |
go install golang.org/x/tools/cmd/goimports |
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 | |
try: | |
import cPickle as pickle | |
except ImportError: | |
import pickle | |
try: | |
import hashlib | |
sha1 = hashlib.sha1 |
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
var cv = document.getElementById('cv'); | |
var c = cv.getContext('2d'); | |
var txtDiv = document.getElementById('txt'); | |
var fileBtn = document.getElementById("up-button"); | |
var img = new Image(); | |
img.src = 'a.jpg'; | |
img.onload = init; // 图片加载完开始转换 | |
fileBtn.onchange = getImg; | |
// 根据灰度生成相应字符 |
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
#!/bin/bash | |
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/ | |
# Install stuff # | |
################# | |
# Install development tools and some misc. necessary packages | |
yum -y groupinstall "Development tools" | |
yum -y install zlib-devel # gen'l reqs |
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
# Combine multiple images into one. | |
# | |
# To install the Pillow module on Mac OS X: | |
# | |
# $ xcode-select --install | |
# $ brew install libtiff libjpeg webp little-cms2 | |
# $ pip install Pillow | |
# | |
from __future__ import print_function |
OlderNewer