Skip to content

Instantly share code, notes, and snippets.

View loonghao's full-sized avatar
😀

Hal loonghao

😀
  • Shenzhen
View GitHub Profile
@raphigaziano
raphigaziano / qtdbg.py
Last active August 16, 2021 15:12
A simple PyQt output widget which can be used as basic debug console
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
qtdbg.py
A simple PyQt output widget.
It's main use case is to serve as an output console, for debugging or
other purposes.
It provides a file-like interface for ease of integration with other
python features such as the logging module, on top of a slightly
@ninehills
ninehills / zerorpc.md
Created June 18, 2013 12:17
ZeroRPC简介 - 轻量级分布式通信框架

ZeroRPC简介 - 轻量级分布式通信框架

概述

分布式系统的核心是分布式通信,而传统上开发一套支持上千台规模集群,可靠性非常高的分布式通信框架,需要不少的精力投入。而在多数情景下,我们(特别是时间宝贵的OP)并不是非常关注技术实现的细节,而是希望有一套成熟、轻量、可靠性高、使用方便而且易于调试的分布式通信框架,可以直接使用,从而把时间放在具体业务逻辑上。

在PyCon 2012大会上,dotcloud公司开源了一套基于ZeroMQ和MessagePack的分布式通信框架(或者说是协议+Python实现)。该框架因为基于ZeroMQ,使用方法是RPC,所以被命名为ZeroRPC。ZeroRPC的特点在其官网的介绍中一目了然[1]:

ZeroRPC is a light-weight, reliable and language-agnostic library for distributed communication between server-side processes.

@sloria
sloria / bobp-python.md
Last active March 3, 2025 16:09
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
@shidarin
shidarin / luts.py
Last active June 13, 2018 16:07
Controlling Nuke Lut Behavior
# =============================================================================
# Controlling Nuke Lut Behavior
# =============================================================================
# From: Controlling Nuke Lut Behavior
# http://shidarin.github.io/2013/controlling-nuke-lut-behavior/
# By: Sean Wallitsch ([email protected])
# =============================================================================
"""Functions for creating LUT groups to be used as ViewerProcesses within Nuke
Synopsis
@fredrikaverpil
fredrikaverpil / export_nodes_and_store_node_data.py
Last active February 1, 2022 14:25
Export and re-assign shaders, nodes and node data #maya
import maya.cmds as cmds
def getAttributes(object):
attributes = cmds.listAttr(object)
for attribute in attributes:
try:
print attribute + ' = ' + str(cmds.getAttr(object + '.' + attribute))
except:
pass
@jason-s
jason-s / qtableview_completer.py
Created August 25, 2014 21:32
example of QTableView + QCompleter in PySide
from PySide import QtCore, QtGui
from PySide.QtCore import Qt
from PySide.QtGui import QWidget, QTableView, QVBoxLayout, QApplication
def setup_consonants_vowels():
letters = 'abcdefghijklmnopqrstuvwxyz'
vowels = set(['a','e','i','o','u','A','E','I','O','U'])
consonants = set([c for c in (letters + letters.upper()) if not c in vowels])
return (consonants, vowels)
@mottosso
mottosso / application.js
Last active October 16, 2021 14:30
Asynchronous call from QML to Python with callback 3
/*
* This gist registers a custom QObject from Python into QML.
* The QObject is called from QML, whereby Python performs an
* expensive operation which, upon completion, emits a signal
* which is then again handled from QML.
*
* See here for an alternative (that doesn't work)
* https://gist.github.com/mottosso/aee134d71864bc8425e0
*/
@PurpleBooth
PurpleBooth / README-Template.md
Last active April 1, 2025 03:07
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@hmasato
hmasato / MAYA_findFlippedUVs.py
Last active January 26, 2021 01:56
[Maya, python] _findFlippedUVs
# -*- coding: utf-8 -*-
import maya.OpenMaya as om
import maya.cmds as cmds
def _findFlippedUVs(nodesOnly=True):
ret = []
selList = om.MSelectionList()
@mottosso
mottosso / 0.md
Last active January 8, 2020 11:23
QML Reference Manager 2 - With Python to QML communication

Description

Same as QML Reference Manager except with data being passed from Python to QML, as a "context property".

Context properties are inserted into the global namespace of QML, the name ("myModel") is directly accessible from any QML file, and the object can be any Python object.