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
# Settings -> Applications -> Manage Applications -> Market -> Clear Cache -> Force Stop (this button will be enabled if your Market is still running) -> OK | |
# Open a console and type the following command (for *nix user, remember to use sudo to avoid permission error): | |
adb shell setprop gsm.sim.operator.numeric 310260 | |
adb shell setprop gsm.operator.numeric 310260 | |
adb shell getprop gsm.sim.operator.iso-country us | |
adb shell getprop gsm.operator.iso-country us |
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
### Testing if the client is a mobile or a desktop. | |
### The selection is based on the usual UA strings for desktop browsers. | |
## Testing a user agent using a method that reverts the logic of the | |
## UA detection. Inspired by notnotmobile.appspot.com. | |
map $http_user_agent $is_desktop { | |
default 0; | |
~*linux.*android|windows\s+(?:ce|phone) 0; # exceptions to the rule | |
~*spider|crawl|slurp|bot 1; # bots | |
~*windows|linux|os\s+x\s*[\d\._]+|solaris|bsd 1; # OSes |
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 | |
/** | |
* Send email | |
* @param string|array $email | |
* @param object $from | |
* @param string $subject | |
* @param string $message | |
* @param string $headers optional | |
*/ | |
function send_email($email, $from, $subject, $message, $headers = null) |
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
header("content-type:text/html;charset=utf-8"); | |
//* | |
//文件头 [第一条索引的偏移量 (4byte)] + [最后一条索引的偏移地址 (4byte)] 8字节 | |
//记录区 [结束ip (4byte)] + [地区1] + [地区2] 4字节+不定长 | |
//索引区 [开始ip (4byte)] + [指向记录区的偏移地址 (3byte)] 7字节 | |
//注意:使用之前请去网上下载纯真IP数据库,并改名为 "CoralWry.dat" 放到当前目录下即可. | |
//by 查询吧 www.query8.com | |
//* | |
class ipLocation { |
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 | |
/* | |
OCP - Opcache Control Panel (aka Zend Optimizer+ Control Panel for PHP) | |
Author: _ck_ (with contributions by GK, stasilok) | |
Version: 0.1.7 | |
Free for any kind of use or modification, I am not responsible for anything, please share your improvements | |
* revision history | |
0.1.7 2015-09-01 regex fix for PHP7 phpinfo | |
0.1.6 2013-04-12 moved meta to footer so graphs can be higher and reduce clutter |
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/python | |
#-*- coding: utf-8 -*- | |
''' | |
http://segmentfault.com/q/1010000000174213 | |
Python验证用户输入IP的合法性,有什么好方法吗? | |
如:<input type="text" name="ip" id="ip" /> 在text里表单输入的字符串 | |
''' |
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 logging | |
import threading | |
class PeriodicThread(object): | |
""" | |
Python periodic Thread using Timer with instant cancellation | |
""" | |
def __init__(self, callback=None, period=1, name=None, *args, **kwargs): |
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
# Enable gzip. Highly recommending for best peformance | |
gzip on; | |
gzip_comp_level 6; | |
gzip_types text/html text/css text/javascript application/json application/javascript application/x-javascript; | |
# By default, do not set expire headers | |
expires 0; | |
# Set expires header for console CSS and JS. | |
# These files are timestamped with each new release, so it is safe to cache them agressively. |
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
/* Go Top */ | |
.go-top { | |
position: fixed; | |
bottom: 2em; | |
right: 2em; | |
text-decoration: none; | |
color: white; | |
background-color: #f6f6f6; | |
background-color: rgba(0, 0, 0, 0.3); | |
font-size: 12px; |
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
@echo off | |
SET st2Path=C:\Program Files\Sublime Text 3\sublime_text.exe | |
rem add it for all file types | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st2Path%,0" /f | |
@reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st2Path% \"%%1\"" /f | |
rem add it for folders | |
@reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f |
OlderNewer