Skip to content

Instantly share code, notes, and snippets.

View NickSeagull's full-sized avatar

Nick Seagull NickSeagull

View GitHub Profile
@melvic-ybanez
melvic-ybanez / what-i-didnt-know-about-fp-2020.md
Last active December 29, 2023 18:32
What I Didn't Know about Functional Programming until 2020

What I Didn't Know about Functional Programming until 2020

  1. Programming using a series of transformations and aggregations, something I've been doing for years, is known as programming in the map/reduce style.
  2. The more abstract the type is, the greater its cardinality, and the smaller the set of operations it supports. So make use of universal quantifiers, particularly by implementing fully parametric functions. They guide you on how to implement their term-level definitions by narrowing down the number of possible implementations. In other words, the type system of Scala (or Haskell, for that matter) is not only great for capturing compile-time errors, but is also capable of leading you to the correct solution.
  3. You can encode union types by combining different Scala features such as type constructors, subtyping and implicits, and by taking advantage of the Curry-Howard Isomorphism and De Morgan's Laws for neg
@oneingan
oneingan / override.nix
Created January 30, 2020 21:45
zigbee2mqtt in nixos
{pkgs ? import <nixpkgs> {
inherit system;
}, system ? builtins.currentSystem}:
let
nodePackages = import ./default.nix {
inherit pkgs system;
};
in
nodePackages // {
-- a component
data FileSystem m = FileSystem {
exists :: Path -> m (Either Text Bool)
, readFile :: Path -> m (Either Text Text)
}
-- a constructor for a mock file system
newFileSystemWith :: (FileSystemValues -> FileSystemValues) -> FileSystem
newFileSystemWith f = FileSystem {
exists = \_ -> pure (_exists $ f fileSystemValues)
@FradSer
FradSer / iterm2_switch_automatic.md
Last active May 3, 2024 19:58
Switch iTerm2 color preset automatic base on macOS dark mode.

The latest beta (3.5) includes separate color settings for light & dark mode. Toggling dark mode automatically switches colors.

Vist iTerm2 homepage or use brew install iterm2-beta to download the beta. Thanks @stefanwascoding.


  1. Add switch_automatic.py to ~/Library/ApplicationSupport/iTerm2/Scripts/AutoLaunch with:
@ryandaniels
ryandaniels / firefox-user.js
Last active December 5, 2022 06:17
Firefox user.js privacy and optimization settings
/*
* Open profile dir - find in about:support or about:profiles
* Copy this file into your profile directory.
* Add changes to this file. Save file.
* Restart Firefox. Below overrides will be loaded.
* Close Firefox and open prefs.js to confirm changes merged there.
* NOTE: only non-default values will be saved to prefs.js
*
*/
@jaywon
jaywon / README.md
Created October 19, 2017 05:54
Static Site Hosting Setup and Deployment with AWS CLI

Create Bucket

aws s3api create-bucket --bucket website-bucket-name --region us-west-2 --acl public-read --create-bucket-configuration LocationConstraint=us-west- 2

Make Bucket A Static Website

aws s3 website s3://website-bucket-name/ --index-document index.html --error-document error.html

Sync Local Project Directory to Static Website Bucket

aws s3 sync projectfolder s3://website-bucket-name --acl public-read

@umidjons
umidjons / youtube-dl-download-audio-only-on-best-quality.md
Last active March 9, 2024 07:54
Download Audio from YouTube with youtube-dl

Download Audio from YouTube

-i - ignore errors

-c - continue

-t - use video title as file name

--extract-audio - extract audio track

@rahulmutt
rahulmutt / Main.hs
Last active October 1, 2020 04:44
Fast coproducts for Haskell & Eta
#!/usr/bin/env stack
{- stack
--resolver lts-6.27
--install-ghc
runghc
--package containers
-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}

⚠️ this is now stupidly out of date

Computers

  • 13" Macbook Pro 3.3 GHz i7 (late 2016)
  • Microsoft Surface Book (2016)

Peripherals