Refined Code for Bryan's blog post
This file contains hidden or 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 | |
| def main(): | |
| n = int(sys.argv[1]) | |
| to_ignore = set([]) | |
| nums = [j for j in range(n, 0, -1)] | |
| nums += [j for j in range(2, n + 1)] | |
| for i in range(1, n + 1): | |
| to_print = [str(j) if j not in to_ignore else " " for j in nums] |
This file contains hidden or 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
| git log --author="Linus Torvalds" --date=iso | perl -nalE 'if (/^Date:\s+[\d-]{10}\s(\d{2})/) { say $1+0 }' | sort | uniq -c|perl -MList::Util=max -nalE '$h{$F[1]} = $F[0]; }{ $m = max values %h; foreach (0..23) { $h{$_} = 0 if not exists $h{$_} } foreach (sort {$a <=> $b } keys %h) { say sprintf "%02d - %4d %s", $_, $h{$_}, "*"x ($h{$_} / $m * 50); }' | |
This file contains hidden or 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 subprocess | |
| import cairo | |
| import wx | |
| import wx.lib.wxcairo | |
| WIDTH = 400 | |
| HEIGHT = 300 | |
| surface = cairo.ImageSurface( |
This file contains hidden or 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
| #!/usr/bin/env python | |
| # a python copy of thanos JS (https://thanosjs.org/) | |
| from __future__ import print_function | |
| import importlib | |
| import os | |
| import random | |
| import sys | |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # coding: utf8 | |
| import sys | |
| import subprocess | |
| import argparse | |
| from pathlib import Path | |
| def ls(path, flags=None): | |
| if not flags: |
This file contains hidden or 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
| # "Understanding Python's closures". | |
| # | |
| # Tested in Python 3.1.2 | |
| # | |
| # General points: | |
| # | |
| # 1. Closured lexical environments are stored | |
| # in the property __closure__ of a function | |
| # | |
| # 2. If a function does not use free variables |
This file contains hidden or 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
| private_* |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| # -*- coding:utf8 -*- | |
| import random | |
| from collections import namedtuple | |
| from itertools import combinations | |
| from string import ascii_letters | |
| import pandas as pd | |
| import funcy as fy | |
| import yappi |