Skip to content

Instantly share code, notes, and snippets.

View mopemope's full-sized avatar
🏠
Working from home

Yutaka Matsubara mopemope

🏠
Working from home
View GitHub Profile
from twisted.web import client
from twisted.internet import reactor, defer
from lxml import etree
from StringIO import StringIO
import re
import os
save_dir = "~/.video/tube8/"
base_url = "http://www.tube8.com"
download_re = re.compile("so.addVariable\('videoUrl',\s*'([\w\d.:/_]*)'\);", re.M)
from twisted.web import client
from twisted.internet import reactor, defer
from lxml import etree
from StringIO import StringIO
import re
import os
save_dir = "~/.video/xhamster/"
base_url = "http://www.xhamster.com"
download_re = re.compile("so.addVariable\('file',\s*'([\w\d\.:/_\-\?=]*)'\);", re.M)
import timeit
from cStringIO import StringIO
x1 = xrange(1000)
x2 = xrange(10000)
smallbuf = "buffer"
bigbuf = "buffer" * 1024
def str_join1000(buf):
simple benchmark
http://github.com/mopemope/meinheld/tree/master/bench/hello/
result:
ma2@xxxx:11:51:ab -c 100 -n 10000 http://192.168.2.10:8000/ ~
This is ApacheBench, Version 2.0.41-dev <$Revision: 1.141 $> apache-2.0
Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright (c) 2006 The Apache Software Foundation, http://www.apache.org/
@mopemope
mopemope / file0.txt
Created September 18, 2015 09:32
YubiKey NEO で Linux でも 2段階認証しよう! ref: http://qiita.com/mopemope/items/779a5a4da734914b9cd0
$ packer -S yubikey-personalization yubikey-personalization-gui yubikey-neo-manager
from os import path
from werkzeug import secure_filename
import eventlet
from eventlet.green import urllib2
from pyquery import PyQuery as pq
from urlparse import urlparse
search_urls = [
'http://www.empflix.com/browsecat.php?page=%s&chid=17&category=rd',
]
from meinheld import server
def hello_world(environ, start_response):
status = '200 OK'
res = "Hello world!"
response_headers = [('Content-type','text/plain')]
start_response(status, response_headers)
print environ
print environ["QUERY_STRING"]
return [res]
import ctypes
i = ctypes.c_char('a')
j = ctypes.pointer(i)
c = 0
while True:
j[c] = 'a'
c += 1
j
@mopemope
mopemope / dos.py
Created February 16, 2011 04:02
Long Header DoS
import httplib, urllib
import threading
def long_header_dos():
print "start "
params = urllib.urlencode({'spam': "1" * 1 })
headers = {
"Host": "www.greplin.com",
"User-Agent": "Mozilla/5.0 (X11; U; Linux i686; ja; rv:1.9.2.7) Gecko/20100715 Ubuntu/10.04 (lucid) Firefox/3.6.7",
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
@mopemope
mopemope / gmail.py
Created February 17, 2011 07:08
use XOAUTH example
import imaplib
import base64
import email
import re
from email import header as _header
#patch
ecre = re.compile(r'''
=\? # literal =?