Skip to content

Instantly share code, notes, and snippets.

View fireball2018's full-sized avatar
🎯
Focusing

fireball2018

🎯
Focusing
View GitHub Profile
@fireball2018
fireball2018 / ipLocation.php
Created May 11, 2011 12:44
IpLocation by QQWry.Dat
<?php
/**
* IP 地理位置查询类
* 用法: $ip = new IpLocation();
* var_dump($ip->getlocation("61.163.77.210"));
*/
class iplocation
{
/**
* QQWry.Dat文件指针
@fireball2018
fireball2018 / weibo.py
Created December 15, 2011 14:34
WeiboMixin for tornado
class WeiboMixin(tornado.auth.OAuth2Mixin):
"""Weibo authentication using the new Graph API and OAuth2."""
_OAUTH_ACCESS_TOKEN_URL = "https://api.weibo.com/oauth2/access_token?"
_OAUTH_AUTHORIZE_URL = "https://api.weibo.com/oauth2/authorize?"
_OAUTH_NO_CALLBACKS = False
access_token = ""
def get_authenticated_user(self, redirect_uri, client_id, client_secret,
@fireball2018
fireball2018 / 12306Assistant.user.js
Created January 8, 2012 10:41
A javascript snippet to help you booking train tickets at 12306.com
/*
12306 Auto Query => A javascript snippet to help you book tickets online.
12306 Booking Assistant
Copyright (C) 2011 Hidden
12306 Auto Query => A javascript snippet to help you book tickets online.
Copyright (C) 2011 Jingqin Lynn
12306 Auto Login => A javascript snippet to help you auto login 12306.com.
Copyright (C) 2011 Kevintop
@fireball2018
fireball2018 / convert.py
Created April 15, 2012 16:43
批量处理当前目录及子目录图片缩略图,使用imagemagick
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import os, sys
iswindows = 'win32' in sys.platform.lower() or 'win64' in sys.platform.lower()
isosx = 'darwin' in sys.platform.lower()
def convert(dirname, size='640x640'):
@fireball2018
fireball2018 / __init__.py
Created August 23, 2012 10:27 — forked from ipconfiger/__init__.py
OAuth包,实现了sina,QQ,网易,搜狐的OAuth认证
# -*- Encoding: utf-8 -*-
import base64
import binascii
import cgi
import hashlib
import hmac
import logging
import time
import urllib
import urlparse
@fireball2018
fireball2018 / gist:3719551
Created September 14, 2012 02:57 — forked from cuimuxi/gist:3719516
gevent crawler
import gevent
from gevent import monkey, queue
monkey.patch_all()
import urllib2
from time import sleep
import traceback
import logging
<?php
error_reporting(7);
ob_start();
$mtime = explode(' ', microtime());
$starttime = $mtime[1] + $mtime[0];
$admin['check'] = "1";
$retime = "yes";
<?php
/**
* 根据指定类生成SOAP WSDL文件
*
* @version 0.2
* @author Jerry [email protected]
* @example PhpWSDL::genWSDL("ClassName", "http://localhost/soap")
*/
@fireball2018
fireball2018 / request_url.py
Created April 11, 2013 09:34
Python requests 绑定源IP
import socket
real_create_conn = socket.create_connection
def set_src_addr(*args):
address, timeout = args[0], args[1]
source_address = ('IP_ADDR_TO_BIND_TO', 0)
return real_create_conn(address, timeout, source_address)
socket.create_connection = set_src_addr
/*=====日历控件=========*/
.calendar2{*width:536px;}
.calendar1{*width:268px;}
.calendar{
border: 1px solid #e1e1e1;
background-color: #ffffff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-border-radius: 2px;
-moz-border-radius: 2px;