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
| #!/usr/bin/env python | |
| # encoding: utf-8 | |
| import time | |
| import socket | |
| from tornado.iostream import IOStream | |
| from tornado.ioloop import IOLoop | |
| from tornado import stack_context | |
| import functools | |
| import collections |
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
| #!/usr/bin/python | |
| # Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org) | |
| # The author disclaims copyright to this source code. | |
| import sys | |
| import struct | |
| import socket | |
| import time | |
| import select |
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
| #! /usr/bin/env python | |
| #coding=utf-8 | |
| import gevent | |
| from gevent.server import StreamServer | |
| from gevent.queue import Queue | |
| import json | |
| def sendmsg2fobj(fobj,msg): |
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
| ''' | |
| Created on Mar 20, 2014, uses PyCrypto/Python 3.3 | |
| @author: Chris Coe | |
| ''' | |
| import binascii | |
| from Crypto.Cipher import AES | |
| class AESCipher: | |
| ''' |
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
| document.addEventListener('WeixinJSBridgeReady', function(){ | |
| //如果执行到这块的代码,就说明是在微信内部浏览器内打开的. | |
| alert('当前页面在微信内嵌浏览器中打开!'); | |
| }); |
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
| from pprint import pprint | |
| import mysql.connector | |
| class MySQLCursorDict(mysql.connector.cursor.MySQLCursor): | |
| def _row_to_python(self, rowdata, desc=None): | |
| row = super(MySQLCursorDict, self)._row_to_python(rowdata, desc) | |
| if row: | |
| return dict(zip(self.column_names, row)) | |
| return None |
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
| source.sh | |
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
| " Vim syntax file | |
| " Language: Lua 4.0, Lua 5.0 and Lua 5.1 | |
| " Maintainer: Marcus Aurelius Farias <marcus.cf 'at' bol com br> | |
| " First Author: Carlos Augusto Teixeira Mendes <cmendes 'at' inf puc-rio br> | |
| " Last Change: 2006 Aug 10 | |
| " Options: lua_version = 4 or 5 | |
| " lua_subversion = 0 (4.0, 5.0) or 1 (5.1) | |
| " default 5.1 | |
| " For version 5.x: Clear all syntax items |
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
| // --- Compiling --- | |
| $ wget http://download.redis.io/releases/redis-2.8.3.tar.gz | |
| $ tar xzvf redis-2.8.3.tar.gz | |
| $ cd redis-2.8.3 | |
| $ make | |
| $ make install | |
| // --- or using yum --- | |
| $ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
| $ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm |
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
| from socket import socket, SO_REUSEADDR, SOL_SOCKET | |
| from asyncio import Task, coroutine, get_event_loop | |
| class Peer(object): | |
| def __init__(self, server, sock, name): | |
| self.loop = server.loop | |
| self.name = name | |
| self._sock = sock | |
| self._server = server | |
| Task(self._peer_handler()) |