Skip to content

Instantly share code, notes, and snippets.

View idrisr's full-sized avatar
🎯

Idris Raja idrisr

🎯
View GitHub Profile
@idrisr
idrisr / signal.ipynb
Created June 10, 2021 15:38
signal fft
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# 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)
""")
@idrisr
idrisr / flyweight.py
Created September 9, 2021 14:55
flyweight
class VehicleFlyWeightPattern:
“”” flyweight pattern to create lighter than air mass transport objects ”””
...
@idrisr
idrisr / ImageDataLoaders.py
Created September 9, 2021 14:59
factory example
class ImageDataLoaders(DataLoaders):
"Basic wrapper around several `DataLoader`s with factory methods for computer vision problems"
@classmethod
...
@idrisr
idrisr / basevisitor.py
Created September 9, 2021 15:02
Visitor Pattern
class BaseVisitor(abc.ABC, Generic[ResultT]):
...
@idrisr
idrisr / traitlets.py
Created September 9, 2021 15:03
Singleton Pattern
>>> from traitlets.config.configurable import SingletonConfigurable
>>> class Foo(SingletonConfigurable): pass
>>> foo = Foo.instance()
>>> foo == Foo.instance()
True
#!/usr/bin/env zsh
NAME=${1:l}
pushd "$1"
pwd
setopt extendedglob
zip -X -0 "${NAME}" mimetype
{
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";
{
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 {
{
inputs.nixpkgs.url = "nixpkgs";
outputs = { self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
nbdkit = with pkgs;