Skip to content

Instantly share code, notes, and snippets.

@8dspaces
8dspaces / plink-plonk.js
Created April 10, 2020 13:40 — forked from tomhicks/plink-plonk.js
Listen to your web pages
@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)表示
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 / .block
Created October 30, 2016 09:30 — forked from mbostock/.block
Google Maps + D3
license: gpl-3.0
@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 / flask-admin many-to-many search.md
Created September 2, 2016 13:31 — forked from riteshreddyr/flask-admin many-to-many search.md
Flask-admin Many-to-Many Search and Filtering

#Flask-admin Many-to-Many Search

Many-to-Many searches are not easily supported by Flask-admin. Read Here for more info

##Solution

  • Add the association tables to the list of join tables so that the join between the two tables can be made through the association table.
  • Reverse the tables to ensure that the association tables are processed before the other join table.

Tested on Flask-Admin 1.1.0

Installing Python 3 compatible Fabric

Unfortunately, Fabric has not yet officilly been ported to Python 3. However, it is possible to get it to work. Here is how I did it.

First, create a virtual environment to run fabric in. (If you haven't set up virtual environments for Python, go ahead and do that now, then come back.) I have the [fink environment] (http://finkproject.org) installed on my Mac, and

@8dspaces
8dspaces / robot_framework_highlight_notepad++.xml
Created April 2, 2016 05:22 — forked from Tattoo/robot_framework_highlight_notepad++.xml
Robot Framework syntax hilighting for Notepad++
<!-- take into use:
Save this file
Open Notepad++
Select menu: Language > Define your language...
You get a popup. Select "Import", navigate to xml-file
Click "Save as" and name your file eg. "RobotFramework"
Now you can open a Robot test suite file and select from Languages -menu the correct language (in the bottom)
-->
<NotepadPlus>
<UserLang name="RobotFramework" ext="txt">
@8dspaces
8dspaces / HP_ALM_python
Created December 11, 2015 09:28 — forked from barkady/HP_ALM_python
HP ALM python RESTful client
# -*- coding: utf-8 -*-
__author__ = 'Arkady.Babaev'
import requests
import xml.etree.ElementTree as ET
class ALMUrl:
def __init__(self, ip, port, domain, project):
self.__base = u'http://' + ip + u':' + port + u'/qcbin'
self.__auth = self.__base + u'/authentication-point/authenticate'
@8dspaces
8dspaces / ipy_repl.py
Created December 10, 2015 07:25 — forked from MattDMo/ipy_repl.py
SublimeREPL ipy_repl.py for running IPython 4/Jupyter in Sublime Text
import os
import sys
import json
import socket
import threading
activate_this = os.environ.get("SUBLIMEREPL_ACTIVATE_THIS", None)
# turn off pager
os.environ['TERM'] = 'emacs'