Skip to content

Instantly share code, notes, and snippets.

@pawelmhm
pawelmhm / header_order_downloader.py
Last active January 3, 2023 04:45
Scrapy downloader that preserves header order
View header_order_downloader.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, unicode_literals
import logging
from collections import OrderedDict
from time import time
from urllib.parse import urldefrag
from scrapy.core.downloader import Downloader
from scrapy.core.downloader.handlers.http11 import HTTP11DownloadHandler, \
@pawelmhm
pawelmhm / simple.py
Last active July 3, 2016 12:33
Twisted resource to test HTTP2
View simple.py
import json
import sys
from twisted.internet.ssl import DefaultOpenSSLContextFactory
from twisted.web import server
from twisted.web.resource import Resource
from twisted.internet import reactor
from twisted.python import log
@pawelmhm
pawelmhm / asyncio_crawler.py
Created February 25, 2016 20:36
basic crawler
View asyncio_crawler.py
#!/usr/local/bin/python3.5
import asyncio
from aiohttp import ClientSession
class Crawler(object):
i = 1
limit = 5
url = "http://localhost:8080/{}"
View discovery_items_data.py
#!/usr/bin/python
from __future__ import print_function
from optparse import OptionParser
import sys
from collections import OrderedDict
import warnings
warnings.filterwarnings("ignore")
import pandas as pd
@pawelmhm
pawelmhm / gist:8917867
Last active December 1, 2021 18:25
Scrapy spider crawling Stack Overflow
View gist:8917867
from scrapy.spider import Spider
from scrapy.contrib.spiders import CrawlSpider, Rule
from scrapy.contrib.linkextractors.sgml import SgmlLinkExtractor
from scrapy.selector import Selector
from scrapy.item import Item, Field
import urllib
class Question(Item):
tags = Field()
answers = Field()
@pawelmhm
pawelmhm / dabblet.css
Created July 1, 2013 14:58
almost a bicycle
View dabblet.css
/* almost a bicycle */
#bike {
width:400px;
height:250px;
position:relative;
margin:20px 0;
-webkit-transition: -webkit-transform 3s linear;
}
@pawelmhm
pawelmhm / index.html
Created July 1, 2013 07:24
A CodePen by Pawel_Miech. Conway's Game Of Life - "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970.[1] The "game" is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Lif…
View index.html
<body>
<div>
<h3> Conway's Game Of Life</h3>
<h4>Click on squares to bring them into life </h4>
Choose the size of cells:
<div><input type="range" id="setSize" name="setSize" min="5" max="120" step="5"/></div>
<div>
<input type="button" id="startGame" value="Start Game"/>
<input type="button" id="killLife" value="Stop Life"/>
<input type="button" id="clearLife" value="Clear Life"/>
@pawelmhm
pawelmhm / index.html
Created June 15, 2013 22:10
A CodePen by pawelmhm.
View index.html
<canvas id="canvas" width="600" height="600"></canvas>
@pawelmhm
pawelmhm / dabblet.css
Created January 25, 2013 18:15
animated sections
View dabblet.css
/**
* animated sections
*/
article {
width:1000px;
height:600px;
}
#lover {
background:red;
@pawelmhm
pawelmhm / dabblet.css
Created January 18, 2013 14:29
The first commented line is your dabblet’s title
View dabblet.css
/**
* The first commented line is your dabblet’s title
*/
#classer {
width:300px;
height:300px;
margin:auto;
}