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 | |
| """Resize the image to given size. | |
| Don't strech images, crop and center instead. | |
| """ | |
| import os | |
| import sys | |
| from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter | |
| from fractions import Fraction | |
| from functools import partial |
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
| /big.txt | |
| /reporttime$py.class |
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 | |
| # -*- coding: utf-8 -*- | |
| """`tree-grep.py [-i] DIR PATTERN` is similar to `tree DIR | grep [-i] PATTERN` | |
| but it shows the whole branch upto the matched child node. | |
| # Installation | |
| * termcolor - helper functions for ANSII color formatting |
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
| #!/bin/bash | |
| # | |
| # Print common lines between all given files | |
| # | |
| # exit on any error | |
| set -e | |
| # exit if no files given | |
| USAGE="Usage: $0 file1 [file2 [file3...]]" |
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
| """time.process_time() and time.perf_counter() for Python 2 on Ubuntu.""" | |
| import ctypes | |
| import errno | |
| from ctypes.util import find_library | |
| from functools import partial | |
| CLOCK_PROCESS_CPUTIME_ID = 2 # time.h | |
| CLOCK_MONOTONIC_RAW = 4 | |
| clockid_t = ctypes.c_int |
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
| """ http://stackoverflow.com/a/13704307 | |
| To convert datetime to np.datetime64 and back (numpy-1.6): | |
| >>> from datetime import datetime | |
| >>> import numpy as np | |
| >>> np.datetime64(datetime(2012, 12, 4, 13, 34, 52, 827542)).astype(datetime) | |
| datetime.datetime(2012, 12, 4, 13, 34, 52, 827542) | |
| It works both on a single np.datetime64 object and a numpy array of np.datetime64. |