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 | |
from moviepy.editor import VideoFileClip | |
import moviepy.video.fx.all as vfx | |
def main(fname_in, fname_out, duration="1.0"): | |
duration = float(duration) | |
clip = VideoFileClip(fname_in) | |
clip = (clip |
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
[general] | |
accounts = Gmail | |
maxsyncaccounts = 3 | |
socktimeout = 90 | |
[Account Gmail] | |
localrepository = Gmail-Local | |
remoterepository = Gmail-Remote | |
[Repository Gmail-Local] |
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
[program:autossh40000] | |
command=bash -c "sleep 15 && exec /usr/lib/autossh/autossh -nN -o StrictHostKeyChecking=no -o ServerAliveInterval=30 -o ServerAliveCountMax=3 -M 40010 -R 0.0.0.0:40000:localhost:22 [email protected]" | |
autorestart=true | |
user=pi |
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
# Toy examples that demonstrate how to configure | |
# nolearn.lasagne.NeuralNet and what data to send in for | |
# classification problems with single and multiple classes, and | |
# regression problems with and without multiple targets. | |
from lasagne.layers import DenseLayer | |
from lasagne.layers import InputLayer | |
from lasagne.nonlinearities import softmax | |
from nolearn.lasagne import NeuralNet | |
import numpy as np |
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
class Func(BaseEstimator): | |
def __init__(self, func): | |
self.func = func | |
def fit(self, X, y=None): | |
return self | |
def transform(self, X): | |
return self.func(X) |
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 cProfile | |
from functools import wraps | |
def profile(func): | |
@wraps(func) | |
def wrapper(*args, **kwargs): | |
cProfile.runctx( | |
'result = func(*args, **kwargs)', | |
globals(), |
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
def query_children(context, levels=3, more_conditions=None): | |
selects = [] | |
for level in range(levels): | |
alias = Node.__table__ | |
conditions = [Node.__table__.c.id == context.id] | |
for depth in range(level + 1): | |
alias, old_alias = Node.__table__.alias(), alias | |
conditions.append(alias.c.parent_id == old_alias.c.id) | |
if more_conditions: |
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
from zope.testbrowser.browser import Browser | |
def _zope_testbrowser_pyquery(self): | |
from pyquery import PyQuery | |
return PyQuery(self.contents) | |
Browser.pyquery = property(_zope_testbrowser_pyquery) | |
# This will allow you to do in your tests: | |
# >>> "Home" in browser.pyquery('#navigation').text() |
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 time | |
def guess_time(s): | |
""" | |
>>> guess_time('20:00') | |
(20, 0) | |
>>> guess_time(' 23:59') | |
(23, 59) | |
>>> guess_time('20:00foo') | |
(20, 0) |
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 datetime | |
import Acquisition | |
from zope import interface | |
from zope import component | |
import plone.postpublicationhook.interfaces | |
#from collective.skinny.interfaces import IPublicLayer |