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 sys | |
import time | |
def progressbar(it, prefix = "", size = 60): | |
count = len(it) | |
def _show(_i): | |
x = int(size*_i/count) | |
sys.stdout.write("%s[%s>%s] %i/%i\r" % (prefix, "="*x, "-"*(size-x), _i, count)) | |
sys.stdout.flush() |
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/bin/env python | |
# I was frustrated that no matter what buffer setting I passed to communicate, | |
# I could not get stdout from my subprocess until the process had completed. | |
# I googled around and came up with this, which illustrates the problem and a | |
# solution. | |
# http://stackoverflow.com/questions/2804543/read-subprocess-stdout-line-by-line | |
# http://bugs.python.org/issue3907 | |
# http://docs.python.org/library/io.html |
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
"""Test of using graphviz's "dot" layout algorithm to arrange a Nuke node-graph | |
Example: http://i.imgur.com/f1mK7.png | |
Left is dot, right is Nuke's builtin nuke.autoplace | |
""" | |
import nuke | |
# http://code.google.com/p/pydot/ | |
import pydot |
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
# ------------------------------------------------------------------------------------------------------------ # | |
# --------------------------------------------- Signal Library ----------------------------------------------- # | |
# ------------------------------------------------------------------------------------------------------------ # | |
import weakref | |
class Signal(object): | |
def __init__(self, *types): | |
self._call_types = types | |
self._connections = set() |
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 functools | |
import logging | |
from google.appengine.api import memcache | |
def cached(time=1200): | |
""" | |
Decorator that caches the result of a method for the specified time in seconds. | |
Use it as: | |
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
/* So how does this work? | |
I'm using ANSI escape sequences to control the behavior of the terminal while | |
cat is outputting the text. I deliberately place these control sequences inside | |
comments so the C++ compiler doesn't try to treat them as code.*/ | |
//[2K[2D[A[2K[A[2K[A[2K[A[2K[A | |
/*The commands in the fake code comment move the cursor to the left edge and | |
clear out the line, allowing the fake code to take the place of the real code. | |
And this explanation uses similar commands to wipe itself out too. */ | |
//[2K[2D[A[2K[A[2K[A[2K[A | |
#include <cstdio> |
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
# coding=utf-8 | |
""" | |
""" | |
__author__ = 'Alisue <lambdalisue@hashnote.net>' | |
try: | |
from PySide import QtCore | |
from PySide import QtGui | |
except ImportError: | |
from PyQt4 import QtCore | |
from PyQt4 import QtGui |
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
module srtp | |
go 1.15 | |
require ( | |
github.com/pion/rtp v1.6.1 | |
github.com/pion/srtp v1.5.2 | |
github.com/pion/webrtc/v3 v3.0.0-beta.13 | |
) |
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
async function setUpLights() { | |
const lightingDevice = await navigator.usb.requestDevice({ filters: [] }); | |
await lightingDevice.open(); | |
await lightingDevice.claimInterface(0); | |
// This comes from https://github.com/NERDDISCO/webusb-dmx512-controller | |
lightingDevice.controlTransferOut({ | |
// It's a USB class request | |
requestType: "class", | |
// The destination of this request is the interface |
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
//Authorization popup window code | |
function ShowAuthWindow(options) | |
{ | |
console.log('ee'); | |
options.windowName = options.windowName || 'ConnectWithOAuth'; // should not include space for IE | |
options.windowOptions = options.windowOptions || 'location=0,status=0,width=800,height=400'; | |
options.callback = options.callback || function(){ window.location.reload(); }; | |
var that = this; | |
console.log(options.path); | |
that._oauthWindow = window.open(options.path, options.windowName, options.windowOptions); |
OlderNewer