This file contains 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 aiohttp | |
import asyncio | |
import time | |
@asyncio.coroutine | |
def get_data(client): | |
with aiohttp.Timeout(10): | |
response = yield from client.get('https://www.google.co.in') | |
return (yield from response.text()) |
This file contains 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 sqlalchemy.ext.automap import automap_base | |
from sqlalchemy.orm import Session | |
from sqlalchemy import create_engine, MetaData | |
from collections import namedtuple | |
import hashlib | |
import os | |
import pickle |
This file contains 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
""" | |
73 74 75 76 77 78 79 80 81 | |
72 43 44 45 46 47 48 49 50 | |
71 42 21 22 23 24 25 26 51 | |
70 41 20 7 8 9 10 27 52 | |
69 40 19 6 1 2 11 28 53 | |
68 39 18 5 4 3 12 29 54 | |
67 38 17 16 15 14 13 30 55 | |
66 37 36 35 34 33 32 31 56 |
This file contains 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
(function() { | |
'use strict'; | |
function get_comment_index(seed, currWidth, prevWidth, prevIndex) { | |
if (currWidth === 0 || prevIndex === undefined) { | |
return seed; | |
} | |
if (currWidth > prevWidth) { | |
return prevIndex + '-' + (seed + 1); | |
} if (currWidth == prevWidth) { |
This file contains 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
var xhr = new XMLHttpRequest(); | |
url = '/url/to/post'; | |
params = JSON.stringify({'key': 'value'}); | |
xhr.open("POST", url, true); | |
xhr.setRequestHeader("Content-Type", "application/json"); | |
xhr.setRequestHeader("Content-Length", params.length); | |
xhr.setRequestHeader("Connection", "close"); | |
xhr.onreadystatechange = function() { |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Loclog</title> | |
<style> | |
body, html { | |
padding: 0; | |
} |
This file contains 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/local/bin/python3 | |
from urllib.parse import urlparse | |
import sys | |
if __name__ == '__main__': | |
if len(sys.argv) == 2: | |
sys.stdout.write(urlparse(sys.argv[1]).netloc) | |
else: | |
sys.stdout.write('doesnotexist.lampost') |
This file contains 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
class Heap: | |
"""Heap implementation""" | |
def __init__(self, arr): | |
self.arr = arr | |
def parent(self, child_index): | |
return self.arr[child_index // 2] | |
def left(self, parent_index): |