Skip to content

Instantly share code, notes, and snippets.

View dodola's full-sized avatar
:octocat:
Focusing

dodola dodola

:octocat:
Focusing
View GitHub Profile
__author__ = 'dodola'
#encoding: utf-8
import time
import urllib.request
import threading
import contextlib
import queue
import string
import shutil
import os
__author__ = 'dodola'
#encoding: utf-8
import time
import urllib.request
import urllib
import threading
import contextlib
import queue
import string
import shutil
__author__ = 'dodola'
#encoding: utf-8
from time import sleep, ctime
import time
import urllib.request
import threading
import contextlib
import queue
import string
import shutil
__author__ = 'dodola'
#encoding: utf-8
from lxml.html import parse
from time import sleep, ctime
import time
import urllib.request
import threading
import contextlib
import queue
/*
* Copyright (C) 2006 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
@dodola
dodola / topit.py
Created April 30, 2015 11:15
Topit.me网站微型爬虫
#encoding: utf-8
__author__ = 'Dodola'
from lxml.html import parse
from time import sleep,ctime
import time
import urllib2
import threading
import contextlib
import os
@dodola
dodola / gist:5310616
Created April 4, 2013 14:02
Android 获取系统已使用的内存
long total=Runtime.getRuntime().totalMemory();//获取系统内存总数
long free=Runtime.getRuntime().freeMemory();//获取剩余内存
long used=total-free;//获取已使用内存
@dodola
dodola / read.java
Created April 4, 2013 14:10
Android 获取数组资源中的值
Resources res=getResources();
TypedArray icons =res.obtainTypedArray(R.array.icons);
Drawable drawable1=icons.getDrawable(0);
Drawable drawable2=icons.getDrawable(1);
Drawable drawable3=icons.getDrawable(2);
@dodola
dodola / Common.c
Created May 31, 2013 10:03
ACM 常用函数
#include <stdio.h>
int getchar( void ); //读取一个字符, 一般用来去掉无用字符
char *gets( char *str ); //读取一行字符串
#include <stdlib.h>
void * malloc( size_t size ); //动态内存分配, 开辟大小为 size 的空间
void qsort( void *buf, size_t num, size_t size, int (*compare)(const void *, const void *) ); //快速排序
Sample:
int compare_ints( const void* a, const void* b )
{
@dodola
dodola / binsearch.cpp
Created June 20, 2013 08:16
二分法查找
#include<iostream>
using namespace std;
bool bin_search(int nums[],int i,int len){
int left=0,right=len-1,middle;
while(left<=right){
middle=left+((right-left)>>1);
if(i>nums[middle]){
left=middle+1;
}else if(i<nums[middle]){