Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| class Colorcodes(object): | |
| """ | |
| Provides ANSI terminal color codes which are gathered via the ``tput`` | |
| utility. That way, they are portable. If there occurs any error with | |
| ``tput``, all codes are initialized as an empty string. | |
| The provides fields are listed below. | |
| Control: |
| <style> | |
| @font-face { | |
| font-family: "Computer Modern"; | |
| src: url('http://mirrors.ctan.org/fonts/cm-unicode/fonts/otf/cmunss.otf'); | |
| } | |
| div.cell{ | |
| width:800px; | |
| margin-left:16% !important; | |
| margin-right:auto; | |
| } |
| #!/usr/bin/env python | |
| # | |
| # Copyright 2001-2002 by Vinay Sajip. All Rights Reserved. | |
| # | |
| # Permission to use, copy, modify, and distribute this software and its | |
| # documentation for any purpose and without fee is hereby granted, | |
| # provided that the above copyright notice appear in all copies and that | |
| # both that copyright notice and this permission notice appear in | |
| # supporting documentation, and that the name of Vinay Sajip | |
| # not be used in advertising or publicity pertaining to distribution |
| <?php | |
| require_once __DIR__ . '/../vendor/autoload.php'; | |
| use Slim\Environment; | |
| class RoutesTest extends PHPUnit_Framework_TestCase | |
| { |
I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
| import os | |
| import sys | |
| from xml.sax import parse | |
| from xml.sax.saxutils import XMLGenerator | |
| class CycleFile(object): | |
| def __init__(self, filename): | |
| self.basename, self.ext = os.path.splitext(filename) | |
| self.index = 0 |
| #!/usr/bin/env bash | |
| set -Eeuo pipefail | |
| trap cleanup SIGINT SIGTERM ERR EXIT | |
| script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
| usage() { | |
| cat <<EOF | |
| Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |