Skip to content

Instantly share code, notes, and snippets.

@8dspaces
8dspaces / async_flask.py
Created September 11, 2016 03:54 — forked from sergray/async_flask.py
Asynchronous requests in Flask with gevent
"""Asynchronous requests in Flask with gevent"""
from time import time
from flask import Flask, Response
from gevent.pywsgi import WSGIServer
from gevent import monkey
import requests
@8dspaces
8dspaces / .block
Created October 30, 2016 09:30 — forked from mbostock/.block
Google Maps + D3
license: gpl-3.0
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'init' ]
2 info using npm@3.10.10
3 info using node@v6.10.1
4 verbose run-script [ 'preinit', 'init', 'postinit' ]
5 info lifecycle ghost@1.0.0-alpha.17~preinit: ghost@1.0.0-alpha.17
6 silly lifecycle ghost@1.0.0-alpha.17~preinit: no script for preinit, continuing
7 info lifecycle ghost@1.0.0-alpha.17~init: ghost@1.0.0-alpha.17
8 verbose lifecycle ghost@1.0.0-alpha.17~init: unsafe-perm in lifecycle true
9 verbose lifecycle ghost@1.0.0-alpha.17~init: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/qimick/Downloads/Ghost-master/node_modules/.bin:/Library/Frameworks/Python.framework/Versions/3.5/bin:/Applications/Postgres.app/Contents/Versions/9.4/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/go/bin
-----npm-debug.log---------
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'init' ]
2 info using npm@3.10.10
3 info using node@v6.10.1
4 verbose run-script [ 'preinit', 'init', 'postinit' ]
5 info lifecycle ghost@1.0.0-alpha.17~preinit: ghost@1.0.0-alpha.17
6 silly lifecycle ghost@1.0.0-alpha.17~preinit: no script for preinit, continuing
import asyncio
loop = asyncio.get_event_loop()
async def hello(task, sleep_seconds):
print('{}:hello'.format(task))
await asyncio.sleep(sleep_seconds)
print('{}:world!'.format(task))
@8dspaces
8dspaces / csv_compare.py
Last active May 20, 2018 00:01
xml/csv compare example
#!/usr/bin/env python2
import csv
import sys
from sys import stdout, stderr
import os
import argparse
class RetainValueIterator(object):
def __init__(self, f):
@8dspaces
8dspaces / py.py
Created July 24, 2018 06:48
python interview questions
# encoding: utf8
# 什么是lambda函数?它有什么好处?另外python在函数式编程方面提供了些什么函数和语法?
# - lambda 就是匿名函数
# - 好处: 可以动态生成一个函数对象,不用给这个对象命名,污染名字空间
# - 函数:map()/filter()
# - 语法:可以函数内部定义函数,闭包支持
# 详细说说tuple、list、dict的用法,它们的特点;
# - tuple 固定长度的子项不可变的顺序型容器,一般用来做常量(策划配表)或者表示少量属性的对象(比如pos)表示
@8dspaces
8dspaces / cypress-package.json
Created April 14, 2019 11:37
example that use cypress-mocha
{
"name": "firestarter",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod",
"test": "ng test --watch false",
"lint": "ng lint",
"e2e": "cypress run",
@8dspaces
8dspaces / plink-plonk.js
Created April 10, 2020 13:40 — forked from tomhicks/plink-plonk.js
Listen to your web pages