Skip to content

Instantly share code, notes, and snippets.

View rebeccaskinner's full-sized avatar

Rebecca Skinner rebeccaskinner

View GitHub Profile
#!/usr/bin/ruby
# Create a simple function to call a lambda
def testCall f
f.call 3
end
# Call testCall with a lambda, this version works
testCall(lambda do |x| puts "test, x = #{x}" end)
@rebeccaskinner
rebeccaskinner / gist:d7268f23b7c848365f91
Created August 7, 2014 19:45
Field-separated value parser
module DynamicNetworkGraph
class NetworkFlow
Fields = [:srcAddr,:dstAddr,:srcPort,:dstPort,:protocol,:start,:end,:packets,:transferred,:status]
attr_accessor :srcAddr
attr_accessor :dstAddr
attr_accessor :srcPort
attr_accessor :dstPort
attr_accessor :protocol
attr_accessor :start
attr_accessor :end
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"strings"
"time"
)
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)

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

@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]
@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 / 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 / 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 #-}
{-# 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 #-}