A concise Publish/Subscribe utility module. It supports both free-form signal names and a stricter style where signals are declared first. You can also mix them.
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
00:00:00.000 [INFO] [sway/main.c:346] Sway version 1.5-e5913f81 (Apr 24 2021, branch 'HEAD') | |
00:00:00.003 [INFO] [sway/main.c:154] Linux splurge 5.11.15-300.fc34.x86_64 #1 SMP Fri Apr 16 13:41:48 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux | |
00:00:00.003 [INFO] [sway/main.c:170] Contents of /etc/os-release: | |
00:00:00.003 [INFO] [sway/main.c:154] NAME=Fedora | |
00:00:00.003 [INFO] [sway/main.c:154] VERSION="34 (Workstation Edition)" | |
00:00:00.003 [INFO] [sway/main.c:154] ID=fedora | |
00:00:00.003 [INFO] [sway/main.c:154] VERSION_ID=34 | |
00:00:00.003 [INFO] [sway/main.c:154] VERSION_CODENAME="" | |
00:00:00.003 [INFO] [sway/main.c:154] PLATFORM_ID="platform:f34" | |
00:00:00.003 [INFO] [sway/main.c:154] PRETTY_NAME="Fedora 34 (Workstation Edition)" |
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 asyncio | |
@asyncio.coroutine | |
def waiting(r): | |
print("hello from waiting -", r) | |
yield from asyncio.sleep(2) | |
print("bye from waiting -", r) | |
return r | |
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
var log4js = require('log4js'), | |
Base = require('mocha/lib/reporters/base'), | |
Dot = require('mocha/lib/reporters/dot'), | |
diff = require('diff'), | |
ms = require('mocha/lib/ms'), | |
color = Base.color; | |
function LogReport(runner) { | |
var captured = [], | |
layout = log4js.layouts.colouredLayout; |
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
var fs = require('fs'), | |
esprima = require('esprima'), | |
escodegen = require('escodegen'), | |
uglify = require('uglifyjs'), | |
_ = require('underscore'); | |
function findScope(tree, key) { | |
var q = [], | |
scope, | |
node; |
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
var log4js = require('log4js'), | |
sentinel = {}; | |
function loopbackAppender() { | |
return function (loggingEvent) { | |
var logger = log4js.getLogger(loggingEvent.categoryName), | |
isRemote = !!loggingEvent.remoteAddress, | |
hasLooped = loggingEvent._loopback !== sentinel; | |
if (hasLooped && isRemote) { |
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
function yielding() { | |
var stop = false, | |
stamp = (new Date()).getTime(), | |
count = 0, | |
clear; | |
function tick() { | |
if (!stop) { | |
count++; | |
clear = setImmediate(tick); |
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
'''Description of bitcoin binary protocol fragments''' | |
from construct import (Construct, ConstructError, Struct, Bytes, Array, | |
ULInt8, ULInt16, ULInt32, ULInt64) | |
class VarInt(Construct): | |
def __init__(self, name): | |
Construct.__init__(self, name) |
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
'''screenshot utilities for selenium | |
Let's you work with screenshots of specific elements as PIL images. | |
>>> el = driver.find_element_by_css_selecto('#logotype') | |
>>> img = screenshot.element(driver, el) | |
>>> ref = Image.open('reference.png') | |
>>> screenshot.compare(ref, img) | |
True | |
''' |
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 bash | |
# Generates gource video (h.264) out of multiple repositories. | |
# Pass the repositories in command line arguments. | |
# Example: | |
# <this.sh> /path/to/repo1 /path/to/repo2 | |
i=0 | |
for repo in $*; do | |
# 1. Generate a Gource custom log files for each repo. This can be facilitated by the --output-custom-log FILE option of Gource as of 0.29: | |
logfile="$(mktemp /tmp/gource.XXXXXX)" |
NewerOlder