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
#!/bin/bash | |
# Windows Cygwin version. Uses inotifywait port from: https://github.com/thekid/inotify-win | |
# This version does not support a built in wait timeout for inotifywait. | |
# The solution is to use the -m switch, and keep inotifywait process spawned outputting events. | |
# For timeouts we take advantage of the -t switch for bash read. | |
# Custom values should probably not be set in here. Copy these vars to stwatch.conf to be loaded by the script. | |
APIKEY= | |
ADDRESS=127.0.0.1:8080 # default configured port for syncthing REST API | |
WATCHDIRS=( ) # These 2 arrays represent corresponding paths/folder IDs | |
WATCHREPOS=( ) |
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 collections, operator, datetime, importlib | |
if 0: | |
trio = module() | |
trio.run = None # type: callable | |
trio.WouldBlock = None | |
trio.Abort = None # type: abort_class | |
trio.current_task = None # type: callable | |
# STUBS for PyCharm | |
class abort_class: |
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 trio,itertools | |
count = itertools.count() | |
async def q_get(nurs,q,container): | |
container.append(await q.get()) | |
nurs.cancel_scope.cancel() | |
async def q_putall(q1,q2): | |
q1.put_nowait(next(count)) | |
q2.put_nowait(next(count)) |
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 trio,itertools,functools | |
# noinspection PyProtectedMember | |
from trio._core._run import Nursery | |
count = itertools.count() | |
tasks = [] | |
async def spin_check(nurs : Nursery, event : trio.Event,container : list, func : callable, reset : callable): | |
while True: | |
reset() | |
if container: | |
print("satisfied already") |
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 httplib | |
import socket | |
import httplib2 | |
# the whole reason this module is necessary is to prevent HEAD requests from auto-closing the connection. | |
class HTTPResponse(httplib.HTTPResponse): | |
def read(self, amt=None): | |
# prevent the HEAD check from closing the connection |
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
{ | |
"account": { | |
"customerInfo": null, | |
"giftCardBalance": null, | |
"giftCardRedeemCode": "", | |
"giftCardRedeemError": "", | |
"isGiftCardRedeemed": false, | |
"isGiftCardRedeemLoading": false, | |
"isLoading": false | |
}, |
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
{ | |
"account": { | |
"customerInfo": null, | |
"giftCardBalance": null, | |
"giftCardRedeemCode": "", | |
"giftCardRedeemError": "", | |
"isGiftCardRedeemed": false, | |
"isGiftCardRedeemLoading": false, | |
"isLoading": false | |
}, |
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
{ | |
"account": { | |
"customerInfo": null, | |
"giftCardBalance": null, | |
"giftCardRedeemCode": "", | |
"giftCardRedeemError": "", | |
"isGiftCardRedeemed": false, | |
"isGiftCardRedeemLoading": false, | |
"isLoading": false | |
}, |
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, cStringIO, sys | |
import itertools, zlib, gzip, os | |
class savedata: | |
# convenience class used only while reading the gzip file header. | |
# it may not be a gzip file, so this instance will hold whatever was read so we don't have to seek backwards | |
def __init__(self, fileobj): | |
self.fileobj = fileobj | |
self.saved_data = cStringIO.StringIO() |
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 cStringIO | |
import logging | |
log = logging.getLogger('log') | |
class te_lengthfound_exception(StandardError): | |
def __init__(self, length, extension): | |
self.length=length | |
self.extension=extension | |
class te_trailer_exception(StandardError): |
OlderNewer