Skip to content

Instantly share code, notes, and snippets.

View idrisr's full-sized avatar
🎯
shedding

Idris Raja idrisr

🎯
shedding
View GitHub Profile
The key thing to understand about big-O notations is that the discussion centers around functions. The input to a Big-O calculation is a function, and the output is another function. The 'O' function is a higher-order function, in that it operates on functions, and returns a function as well.
This is a notion well understood by haskell programmers, and anyone accustomed to using lambda abstractions, which I believe includes nearly all functional programmers. Python programmers are familiar with these ideas from decorators. When I programmed with python, decorators were a head-scratcher, in that once decorators were stacked upon other decorators, I'd be on shaky ground. The use of types greatly illuminates the concepts, so I'll switch to them here.
We can consider the function BigO :: (a -> N) -> (N -> N), where N is the natural numbers and a is a generic. That a in any problem where complexity analysis being applied will typically stand for some data structure like a binary tree or a linked list. It's whate
module Main where
-- https://github.com/Yuras/pdf-toolbox/issues/62
import Pdf.Document
import qualified Pdf.Core as PC
import System.Environment
import qualified Data.Text as T
printRect :: String -> IO ()
{
inputs.nixpkgs.url = "nixpkgs";
description = "qemu rust game of life";
outputs = { self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
thing = with pkgs;
stdenv.mkDerivation rec {
name = "gameoflife";
{
inputs.nixpkgs.url = "nixpkgs";
description = "qemu rust game of life";
outputs = { self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
thing = with pkgs;
stdenv.mkDerivation rec {
name = "gameoflife";
{
inputs.nixpkgs.url = "nixpkgs";
description = "qemu rust game of life";
outputs = { self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
thing = with pkgs;
stdenv.mkDerivation {
name = "gameoflife";
{
inputs.nixpkgs.url = "nixpkgs";
outputs = { self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
nbdkit = with pkgs;
{
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";
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";
#!/usr/bin/env zsh
NAME=${1:l}
pushd "$1"
pwd
setopt extendedglob
zip -X -0 "${NAME}" mimetype
@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