Skip to content

Instantly share code, notes, and snippets.



Block or report user

Report or block Zulko

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
Zulko /
Created Apr 25, 2019
Get complex matplotlib layouts by generating gridspac from a "layout array"
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:
import dnachisel as dc
def make_random_restriction_part(part_length, left_overhang, right_overhang,
enzyme, forbidden_enzymes,
"""Create a random sequence with just a single wanted restriction
site in the middle, no forbidden enzyme site, and flanked by BsmBI
l_left = len(left_overhang)
l_right = len(right_overhang)
View rough-tests.html
<!-- saved from url=(0044) -->
<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>
svg {
display: block;
width: 800px;
height: 600px;
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]), '...']
Zulko /
Created May 9, 2018
Makes a GIF showing DNA Chisel's algorithm in action
# Warning: quick and dirty code.
import dnachisel as dc
import proglog
import matplotlib.pyplot as plt
from dna_features_viewer import BiopythonTranslator, GraphicFeature
counter = [0]
Zulko /
Created Apr 26, 2018
Draw any picture with plain circles
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),
pdf_path=None, png_path=None):
image = np.array( / 255.0
Zulko /
Last active Mar 17, 2018
some tests
We couldn’t find that file to show.
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -a -q)
Zulko /
Created Apr 18, 2017
Automatic Python module class tree generation, using Mermaid for rendering
import inspect
def class_name(cls):
"""Return a string representing the class"""
# NOTE: can be changed to str(class) for more complete class info
return cls.__name__
def classes_tree(module, base_module=None):
if base_module is None:
base_module == module.__name__
An alternative text clip for Moviepy, relying on Gizeh instead of ImageMagick
- Super fast (20x faster)
- no need to install imagemagick
- full-vector graphic, no aliasing problems
- Easier font names
You can’t perform that action at this time.