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 moviepy.editor import * | |
from moviepy import * | |
video = VideoFileClip(r"[MYFILE]").subclip(50,60) | |
# Make the text. Many more options are available. | |
txt_clip = ( TextClip("My Holidays 2013",fontsize=70,color='white') | |
.set_position('center') | |
.set_duration(10) ) |
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 numpy as np | |
segments_lengths = [3, 2, 2, 2, 1, 1, 1, 2, 2, 1, 1, 2, 1, 2, 1, 1, 2] | |
assert sum(segments_lengths) == 27 | |
def solve(cube, position, direction, segment_number): | |
if segment_number == len(segments_lengths): | |
return cube | |
x, y, z = direction | |
a1, a2 = np.array([y, z, x]), np.array([z, x, y]) |
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 numpy as np | |
from matplotlib.gridspec import GridSpec | |
def matplotlib_gridspecs_from_array(arr): | |
arr = np.array(arr) | |
h, w = arr.shape | |
values_in_arr = sorted(set(arr.flatten())) | |
result = [] | |
grid = GridSpec(h, w) | |
for v in values_in_arr: |
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 dnachisel as dc | |
def make_random_restriction_part(part_length, left_overhang, right_overhang, | |
enzyme, forbidden_enzymes, | |
assembly_enzyme='BsmBI'): | |
"""Create a random sequence with just a single wanted restriction | |
site in the middle, no forbidden enzyme site, and flanked by BsmBI | |
sites.""" | |
l_left = len(left_overhang) | |
l_right = len(right_overhang) |
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
<!-- saved from url=(0044)http://roughjs.com/examples/sampler-svg.html --> | |
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
<title>RoughJS SVG sample</title> | |
<script src="./sample_files/rough.min.js"></script> | |
<style> | |
svg { | |
display: block; | |
width: 800px; | |
height: 600px; |
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 json | |
def schema(json_object): | |
if hasattr(json_object, 'items'): | |
result = {} | |
for k, v in json_object.items(): | |
if hasattr(v, 'items'): | |
result[k] = schema(v) | |
elif isinstance(v, list): | |
result[k] = [schema(v[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
# Warning: quick and dirty code. | |
import dnachisel as dc | |
import proglog | |
proglog.notebook() | |
import matplotlib.pyplot as plt | |
from dna_features_viewer import BiopythonTranslator, GraphicFeature | |
counter = [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 gizeh as gz | |
from PIL import Image | |
import numpy as np | |
def draw_with_circles(image_path, min_r=2, max_r=10, skew=0.2, | |
padding=0.5, bg_color=(1, 1, 1), | |
draw_bg_color=False, | |
pdf_path=None, png_path=None): | |
image = np.array(Image.open(image_path)) / 255.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
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) | |
docker rmi $(docker images -a -q) |
NewerOlder