This file contains hidden or 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 | |
echo "\033[1;34m" | |
cat << "EOF" | |
___ ____ _ _ ______ | |
| \/ (_) | | (_) |___ / | |
| . . |_ __ _ _ __ __ _| |_ _ ___ _ __ / / ___ _ __ ___ | |
| |\/| | |/ _` | '__/ _` | __| |/ _ \| '_ \ / / / _ \| '_ \ / _ \ | |
| | | | | (_| | | | (_| | |_| | (_) | | | | ./ /__| (_) | | | | __/ | |
\_| |_/_|\__, |_| \__,_|\__|_|\___/|_| |_| \_____/\___/|_| |_|\___| |
This file contains hidden or 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 UIKit | |
import AVFoundation | |
var audioPlayer:AVAudioPlayer! | |
class ViewController: UIViewController { | |
override func viewDidLoad() { | |
super.viewDidLoad() |
This file contains hidden or 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
LD_LIBRARY_PATH=/usr/local/opt/openssl/lib:"${LD_LIBRARY_PATH}" | |
CPATH=/usr/local/opt/openssl/include:"${CPATH}" | |
PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig:"${PKG_CONFIG_PATH}" | |
export LD_LIBRARY_PATH CPATH PKG_CONFIG_PATH |
This file contains hidden or 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
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
" Important: | |
" This requries that you install https://github.com/amix/vimrc ! | |
" | |
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" | |
"""""""""""""""""""""""""""""" | |
" => Load pathogen paths | |
"""""""""""""""""""""""""""""" |
This file contains hidden or 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
def _Read(self, url): | |
'''?????? ??? ? ?????????? ?????''' | |
attemptsCount = 2 | |
for _ in range(attemptsCount): | |
try: | |
buf = cStringIO.StringIO() | |
curl = pycurl.Curl() | |
curl.setopt(pycurl.HTTPHEADER, ["Accept:"]) | |
curl.setopt(pycurl.FOLLOWLOCATION, 1) | |
curl.setopt(pycurl.MAXREDIRS, 5) |
This file contains hidden or 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
def info(self): | |
"Return a dictionary with all info on the last response." | |
m = {} | |
m['effective-url'] = self.handle.getinfo(pycurl.EFFECTIVE_URL) | |
m['http-code'] = self.handle.getinfo(pycurl.HTTP_CODE) | |
m['total-time'] = self.handle.getinfo(pycurl.TOTAL_TIME) | |
m['namelookup-time'] = self.handle.getinfo(pycurl.NAMELOOKUP_TIME) | |
m['connect-time'] = self.handle.getinfo(pycurl.CONNECT_TIME) | |
m['pretransfer-time'] = self.handle.getinfo(pycurl.PRETRANSFER_TIME) | |
m['redirect-time'] = self.handle.getinfo(pycurl.REDIRECT_TIME) |
This file contains hidden or 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
# Extension of http://www.yilmazhuseyin.com/blog/dev/create-thumbnails-imagefield-django/ | |
# Note: image_folder and thumbnail_folder are both a callable (ie. a lambda that does a '/'.join()) | |
class Image(Media): | |
image = models.ImageField( | |
upload_to=image_folder | |
) | |
thumbnail = models.ImageField( |
This file contains hidden or 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 socket | |
import traceback | |
import colors | |
import sys, getopt | |
def main(argv): | |
flags , port = argv[1].split("=") |
This file contains hidden or 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
//分页方法,根据传递过来的页数,每页数,总数,返回分页的内容 7个页数 前 1,2,3,4,5 后 的格式返回,小于5页返回具体页数 | |
func Paginator(page, prepage int, nums int64) map[string]interface{} { | |
var firstpage int //前一页地址 | |
var lastpage int //后一页地址 | |
//根据nums总数,和prepage每页数量 生成分页总数 | |
totalpages := int(math.Ceil(float64(nums) / float64(prepage))) //page总数 | |
if page > totalpages { | |
page = totalpages | |
} |
This file contains hidden or 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
" Tab navigation like Firefox. | |
nnoremap <C-S-tab> :tabprevious<CR> | |
nnoremap <C-tab> :tabnext<CR> | |
nnoremap <C-t> :tabnew<CR> | |
"""""""""""""""""""""""""""""" | |
" => CTRL-P | |
"""""""""""""""""""""""""""""" | |
let g:ctrlp_working_path_mode = 'ra' |