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
| # take from the book Python for DevOps, https://www.amazon.com/Python-DevOps-Ruthlessly-Effective-Automation/dp/149205769X | |
| cdp () { | |
| dir=$(python3 -c """ | |
| from pathlib import Path | |
| try: | |
| import ${1} as _ | |
| print(Path(_.__file__).parent) | |
| except Exception as e: | |
| print(e) | |
| """) |
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
| class VehicleFlyWeightPattern: | |
| “”” flyweight pattern to create lighter than air mass transport objects ””” | |
| ... |
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
| class ImageDataLoaders(DataLoaders): | |
| "Basic wrapper around several `DataLoader`s with factory methods for computer vision problems" | |
| @classmethod | |
| ... |
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
| class BaseVisitor(abc.ABC, Generic[ResultT]): | |
| ... |
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
| >>> from traitlets.config.configurable import SingletonConfigurable | |
| >>> class Foo(SingletonConfigurable): pass | |
| >>> foo = Foo.instance() | |
| >>> foo == Foo.instance() | |
| True |
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 zsh | |
| NAME=${1:l} | |
| pushd "$1" | |
| pwd | |
| setopt extendedglob | |
| zip -X -0 "${NAME}" mimetype |
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
| { | |
| inputs.nixpkgs.url = "nixpkgs"; | |
| description = "2020 qemu advent calendar"; | |
| outputs = { self, nixpkgs, ... }: | |
| let | |
| system = "x86_64-linux"; | |
| pkgs = import nixpkgs { inherit system; }; | |
| prog = with pkgs; | |
| stdenv.mkDerivation { | |
| name = "qemu-advent-day01"; |
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
| { | |
| inputs.nixpkgs.url = "nixpkgs"; | |
| description = "qemu with lm32"; | |
| outputs = { self, nixpkgs, ... }: | |
| let | |
| system = "x86_64-linux"; | |
| pkgs = import nixpkgs { inherit system; }; | |
| qemu52 = with pkgs; | |
| stdenv.mkDerivation { |
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
| { | |
| inputs.nixpkgs.url = "nixpkgs"; | |
| outputs = { self, nixpkgs, ... }: | |
| let | |
| system = "x86_64-linux"; | |
| pkgs = import nixpkgs { inherit system; }; | |
| nbdkit = with pkgs; |