Skip to content

Instantly share code, notes, and snippets.

@8dspaces
8dspaces / 0_reuse_code.js
Last active May 19, 2018 13:39
算法练习(一)
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@8dspaces
8dspaces / client.js
Last active August 30, 2015 04:20 — forked from steinwaywhw/client.js
A minimal term.js server/client demo. To be used with node.js
var client = {};
client.run = function (options) {
options = options || {};
var socket = io.connect(options.remote || "http://localhost:8080");
socket.on('connect', function() {
var term = new Terminal({
@8dspaces
8dspaces / bobp-python.md
Created November 22, 2015 13:34 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@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'
@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 / 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">

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 / 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

@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