Skip to content

Instantly share code, notes, and snippets.

View Deitrl's full-sized avatar

Vladyslav Boridko Deitrl

View GitHub Profile
use std::fmt;
use std::boxed::Box;
use std::cmp::Ordering;
struct Tree<T> {
root: Option<Box<Node<T>>>
}
pub struct Node<T> {
left: Option<Box<Node<T>>>,
@Deitrl
Deitrl / gist:6d69a70a06f8e2b8001b7d3a9ca209f7
Created July 26, 2017 19:02 — forked from aidanhs/gist:5ac9088ca0f6bdd4a370
Rust binary tree worked example

% Let's build a binary tree!

Let's build a binary tree of strings in Rust. To recap, each node in a binary tree:

  1. must have a value
  2. may or may not have left and/or right children

So we can describe a single node like this:

@Deitrl
Deitrl / gist:5139c0aaeb7cea1f340e4545d7615470
Created July 26, 2017 19:02 — forked from aidanhs/gist:5ac9088ca0f6bdd4a370
Rust binary tree worked example

% Let's build a binary tree!

Let's build a binary tree of strings in Rust. To recap, each node in a binary tree:

  1. must have a value
  2. may or may not have left and/or right children

So we can describe a single node like this:

Selenium with Python

Author: Baiju Muthukadan
Email:baiju.m.mail AT gmail.com
Version: 0.3.2

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 $2

Results