Susan Potter

Code snippets and technical notes

snippets: Created / Updated

Socket Statistics on Linux with ss

An excellent tool when you need to troubleshoot distributed systems is ss, which provides visibility into TCP states of your live connections. Even if you know netstat this is a command you should get acquainted with because of its more powerful interface which requires fewer pipes to find the connection information you need and it is probably already …

    snippets: Created / Updated

    Profunctor exploration in less than 100 lines of Haskell

    A snippet showing the design space around profunctors using Haskell as the teaching language Includes sighting of Strong, Choice, Cartesian and more profunctors.

    snippets: Created / Updated

    Decoding lens operators

    Notation conventions The following table provides a quick overview of conventions used in symbolic operators in the lens library. Symbol Concept Denotes ^ getter gets value from structure ~ setter sets values in structure % over apply transformation over selected substructure = state threads state through << before change returns value before …

      snippets: Created / Updated

      Ruby 2.4 changes overview

      Unified Fixnum and Bignum into Integer It’s backward compatible too. $ irb irb(main):001:0> RUBY_VERSION => "2.3.1" irb(main):002:0> (2**100).class => Bignum irb(main):003:0> 2.class => Fixnum irb(main):004:0> Fixnum => Fixnum irb(main):005:0> Bignum => Bignum irb(main):006:0> Bogonum NameError: uninitialized …

      snippets: Created / Updated

      Nix in your home directory

      Prerequisites wget is installed tar is installed Purpose If you really don't want to install Nix under /nix (or you can't) then you can install Nix in your home directory like in the homedir_install.sh script included in this Gist. Now whenever you want to run a command under Nix's control, you should prefix with nixrun. Good luck. …

        snippets: Created / Updated

        Erlang OTP Glossary of Terms

        I am hoping this will serve as a reference for coworkers and others new to Erlang and OTP to be able to figure out the terminology easier than I had to. I learned the hard way, so you don't have to!:) Erlang/OTP - The set of libraries and conventions that are used as part of the core Erlang distribution by Ericsson to build fault-tolerant, distributed …

        snippets: Created / Updated

        Erlang Meck API notes

        Here is a snippet showing how to use the Meck API which is a mocking library in Erlang. We will show how to create a fully mocked version of an existing module, unloading mocks, removing functions from a mocked module, and getting a list of all function calls to a module.

        snippets: Created / Updated

        Predicate Algebra in Python

        Updated for Python3 recently: class Predicate: """ Define predicate algebra. >>> isEven=Predicate(lambda x: x % 2 == 0) >>> isOdd=Predicate(lambda x: x % 2 == 1) >>> isEven(6) True >>> isOdd(6) False >>> isEmpty=Predicate(lambda s: s == "") >>> isNotEmpty=~isEmpty >>> …