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 bs4 | |
from requests import Session | |
vk_url = 'http://vk.com' | |
def get_events_urls(group_id, oid): | |
group_url = ''.join([vk_url, '/', group_id]) | |
session = Session() | |
session.head(group_url) | |
response = session.post( |
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
create table medal_scd ( | |
id number(20), | |
quantity number(20), | |
start_date date, | |
end_date date, | |
status char (1 byte) | |
); | |
create table medal_src ( | |
id number(20), |
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 bottle import route, run, install | |
from bottle_sqlite import SQLitePlugin | |
install(SQLitePlugin(dbfile='bottle.db')) | |
@route('/db/') | |
def database(db): | |
data = db.execute('SELECT SQLITE_VERSION()').fetchone() | |
print "SQLite version: %s" % data |
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
telnet coursify.ru 80 | |
Trying 95.85.32.220... | |
Connected to coursify.ru. | |
Escape character is. | |
POST /login HTTP/1.1 | |
Host: coursify.ru | |
Content-Type: application/x-www-form-urlencoded | |
Content-Length: 0 | |
Content-Disposition: form-data; login="user"; password="12345678" |
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 bs4 | |
import requests | |
import argparse | |
import re | |
from multiprocessing import Pool | |
root_url = 'http://pyvideo.org' | |
index_url = root_url + '/category/50/pycon-us-2014' |
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 time | |
import random | |
import select | |
import socket | |
def chk(data): | |
x = sum(a + b * 256 for a, b in zip(data[::2], data[1::2] + b'\x00')) & 0xFFFFFFFF | |
x = (x >> 16) + (x & 0xFFFF) | |
x = (x >> 16) + (x & 0xFFFF) |
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
with data as ( | |
select 50 as col1, 0 as col2 from dual union all | |
select 0 as col1, 20 as col2 from dual union all | |
select 20 as col1, 10 as col2 from dual union all | |
select 20 as col1, 10 as col2 from dual | |
) | |
select avg(nullif(col1, 0)) as col1_avg_no_zero, | |
avg(nullif(case when col2 = 0 then 0 else col1 end, 0)) as col1_avg_no_zero_with_col2 | |
from data; |
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 random import randint | |
def kill_negative(n): | |
if n < 0: | |
n = 0 | |
return n | |
def calc_attack(level): | |
return level*6 |
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
# http://tech.blog.aknin.name/2010/04/02/pythons-innards-introduction/ | |
# http://tech.blog.aknin.name/category/my-projects/pythons-innards/ | |
# http://akaptur.github.io/blog/2013/08/14/python-bytecode-fun-with-dis/ | |
# from vm import VirtualMachine | |
# vm = VirtualMachine() | |
# vm.byte_LOAD_CONST('a') | |
# vm.byte_LOAD_CONST('b') | |
# vm.byte_BUILD_LIST(2) | |
# vm.byte_BUILD_LIST(0) |
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
>>> my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] | |
>>> my_list | |
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] |