Skip to content

Instantly share code, notes, and snippets.

@hfeeki
hfeeki / citydata.js
Created December 27, 2015 10:16 — forked from TooBug/citydata.js
2012年底统计中国行政区域数据(二级)
var citydata =[
{province:'北京市',city:['东城区','西城区','朝阳区','丰台区','石景山区','海淀区','门头沟区','房山区','通州区','顺义区','昌平区','大兴区','怀柔区','平谷区','密云县','延庆县']},
{province:'天津市',city:['和平区','河东区','河西区','南开区','河北区','红桥区','东丽区','西青区','津南区','北辰区','武清区','宝坻区','滨海新区','宁河县','静海县','蓟县']},
{province:'河北省',city:['石家庄市','唐山市','秦皇岛市','邯郸市','邢台市','保定市','张家口市','承德市','沧州市','廊坊市','衡水市']},
{province:'山西省',city:['太原市','大同市','阳泉市','长治市','晋城市','朔州市','晋中市','运城市','忻州市','临汾市','吕梁市']},
{province:'内蒙古自治区',city:['呼和浩特市','包头市','乌海市','赤峰市','通辽市','鄂尔多斯市','呼伦贝尔市','巴彦淖尔市','乌兰察布市','兴安盟','锡林郭勒盟','阿拉善盟']},
{province:'辽宁省',city:['沈阳市','大连市','鞍山市','抚顺市','本溪市','丹东市','锦州市','营口市','阜新市','辽阳市','盘锦市','铁岭市','朝阳市','葫芦岛市']},
{province:'吉林省',city:['长春市','吉林市','四平市','辽源市','通化市','白山市','松原市','白城市','延边朝鲜族自治州']},
{province:'黑龙江省',city:['哈尔滨市','齐齐哈尔市','鸡西市','鹤岗市','双鸭山市','大庆市','伊春市','佳木斯市','七台河市','牡丹江市','黑河市','绥化市','大兴安岭地区']},
{province:'上海市',city:['黄浦区','徐汇区','长宁区','静安区','普陀区','闸北区','虹口区','杨浦区','闵行区','宝山区','嘉定区','浦东新区','金山区','松江区','青浦区','奉贤区','崇明县']},
@hfeeki
hfeeki / install_ethereum.sh
Created April 11, 2015 02:37
Install ethereum for ubuntu
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ethereum/ethereum-qt
sudo add-apt-repository ppa:ethereum/ethereum
sudo add-apt-repository ppa:ethereum/ethereum-dev
sudo apt-get update
sudo apt-get install ethereum
@hfeeki
hfeeki / build_webrtc_android.sh
Last active August 29, 2015 14:12
Build webrtc for android on Ubuntu 14.04
# Installs the required dependencies on the machine
install_dependencies() {
sudo apt-get -y install wget git gnupg flex bison gperf build-essential zip curl subversion pkg-config
sudo apt-get -y install libxtst-dev libgnome-keyring-dev
#Download the latest script to install the android dependencies for ubuntu
curl -o install-build-deps-android.sh https://src.chromium.org/svn/trunk/src/build/install-build-deps-android.sh
#use bash (not dash which is default) to run the script
# it will install openjdk7
sudo /bin/bash ./install-build-deps-android.sh
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
Google Apps for Android 4.2 (https://www.androidfilehost.com/?fid=23060877490000128 - gapps-jb-20130812-signed.zip)
Google Apps for Android 4.1 (https://www.androidfilehost.com/?fid=22979706399755082 - gapps-jb-20121011-signed.zip)
/*
* Copyright (C) 2010 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@hfeeki
hfeeki / docker_tool.sh
Created January 1, 2015 18:12
Docker tools
// run a interactive shell
docker pull ubuntu
docker run -i -t ubuntu /bin/bash
/*
* Copyright 2014 Prateek Srivastava
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
extern mod extra;
use std::{int,io,result};
use extra::{net,net_tcp,uv};
fn main() {
let (accept_port, accept_chan) = stream();
let (finish_port, finish_chan) = stream();
let addr = extra::net_ip::v4::parse_addr("127.0.0.1");
/**
* An implementation for Quicksort. Doesn't
* perform as well as the native Array.sort
* and also runs the risk of a stack overflow
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {
* array.push(Math.round(Math.random() * 100));
@hfeeki
hfeeki / IDBStore.coffee
Last active August 29, 2015 14:11
IndexedDB put & get image test code
#global window:false, self:false, define:false, module:false
###*
@license IDBWrapper - A cross-browser wrapper for IndexedDB
Copyright (c) 2011 - 2013 Jens Arps
http://jensarps.de/
Licensed under the MIT (X11) license
###
"use strict"