Skip to content

Instantly share code, notes, and snippets.

View rebeccaskinner's full-sized avatar

Rebecca Skinner rebeccaskinner

View GitHub Profile
@rebeccaskinner
rebeccaskinner / Sized.hs
Created October 18, 2024 18:53
Simple Sized Vector
{-# LANGUAGE NoStarIsType #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE ConstraintKinds #-}
module Data.Vector.Sized where
import Prelude hiding (take, map)
import Data.Vector (Vector)
import Data.Vector qualified as Vec
import Data.Kind
@rebeccaskinner
rebeccaskinner / BKTree.hs
Created October 17, 2024 15:30
Naive BKTree implementation in Haskell
module Data.BKTree where
import Prelude hiding (lookup)
import Text.Printf
data BKTreeData d a where
Node :: a -> [(d, BKTreeData d a)] -> BKTreeData d a
deriving Show
insertWithMetric :: (Eq d, Num d) => (a -> a -> d) -> a -> BKTreeData d a -> BKTreeData d a
insertWithMetric metric val t@(Node nodeVal children)
@rebeccaskinner
rebeccaskinner / Len.hs
Created May 13, 2024 14:47
Compare lengths of finite and infinite lists
data Length = forall x. Length { unLength :: [x] }
instance Eq Length where
(==) (Length []) (Length []) = True
(==) (Length (_:xs)) (Length (_:ys)) = Length xs == Length ys
(==) _ _ = False
instance Ord Length where
compare (Length []) (Length []) = EQ
compare (Length (_:_)) (Length []) = GT
{-# HLINT ignore "Use lambda-case" #-}
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE FlexibleInstances #-}
@rebeccaskinner
rebeccaskinner / FizzBuzz.hs
Created September 25, 2021 23:55
FizzBuzz in Haskell
{-# LANGUAGE NoStarIsType #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE UndecidableInstances #-}
{-# LANGUAGE ConstraintKinds #-}
@rebeccaskinner
rebeccaskinner / FindMax.hs
Last active September 13, 2021 17:25
FindMax.hs
module FindMax where
import System.Environment (getArgs)
import GHC.Arr
import Control.Monad
import Control.Monad.ST
import Text.Printf
-- | The multiplier that we use when calculating occurrences is the
-- maximum number in the array, plus one. We can only use the modulo
-- offset algorithm when the largest number in the input list is less
@rebeccaskinner
rebeccaskinner / ByteRing.hs
Created June 14, 2021 05:24
RingBuffer In A Byte String
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ImportQualifiedPost #-}
{-# LANGUAGE ForeignFunctionInterface #-}
module ByteRing where
import Foreign.Ptr
import Foreign.C.Types
import Foreign.C.String
import Foreign.ForeignPtr
import System.Posix.Types
import System.Posix.Internals
@rebeccaskinner
rebeccaskinner / Buckets.hs
Created March 20, 2021 01:07
A quick explanation of how to approach a leetcode problem some folks asked about
module Main where
import Data.List (transpose)
import qualified Data.Vector as Vec
import Data.Matrix hiding (transpose)
-- Start with some sample starting bucket to test our program. It
-- contains a set of buckets each of which will have some number of
-- balls in them. The example here has 0 or 1 balls in each bucket,
-- but we could theoretically have any number >= 0.
sampleStartingBucket :: [Int]

This is a common approach by groups who perpetuate hate speech- to exclaim with faux outrage that any limits on hate speech are tantamount to the dissolution of free speech at the behest of ostensibly powerful minority groups. I won't go so far as to accuse you of being a member of hate groups, but your response certainly echoes the propaganda that they spread, especially in forums like HN.

The fact is that society has always drawn lines about what speech and behavior is and isn't acceptable in different venues and circumstances. Facebook's choice to censor hate speech is no different from a bar, restaurant, or department store asking someone to leave for shouting the N-word at fellow shoppers. It's a private non-governmental entity making a choice about how they want their users to act on their platform.

Furthermore, free speech claims in favor of hate speech ignore the real material costs in human lives that facilitating hate speech incurs. While I greatly value free speech personally, I also greatly

func main() {
config, err := getArgs()
if err != nil {
fmt.Println(err)
fmt.Println(showHelp())
os.Exit(1)
}
var (
getEndpoint = fmt.Sprintf("%s/oldusers/%s", config.endpoint, config.username)