Skip to content

Instantly share code, notes, and snippets.

@hyperupcall
hyperupcall / settings.jsonc
Last active May 13, 2024 22:21
VSCode config to disable popular extensions' annoyances (telemetry, notifications, welcome pages, etc.)
// I'm tired of extensions that automatically:
// - show welcome pages / walkthroughs
// - show release notes
// - send telemetry
// - recommend things
//
// This disables all of that stuff.
// If you have more config, leave a comment so I can add it!!
{

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@paulp
paulp / demo.sh
Last active June 8, 2018 09:16
Enabling sbt plugins from the command line in any sbt project
% sbtx dependencyGraph
... blah blah ...
[info] *** Welcome to the sbt build definition for Scala! ***
[info] Check README.md for more information.
[error] Not a valid command: dependencyGraph
[error] Not a valid project ID: dependencyGraph
% sbtx -Dplugins=graph dependencyGraph
... blah blah ...

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@adamw
adamw / windowing.scala
Created August 5, 2016 13:30
Windowing data in Akka
package com.softwaremill.akka
import java.time._
import akka.actor.ActorSystem
import akka.stream.ActorMaterializer
import akka.stream.scaladsl.Source
import scala.collection.mutable
import scala.concurrent.Await
@kennwhite
kennwhite / Launch_Alpine_Linux_3.3.x_on_AWS.md
Last active December 15, 2017 14:57
Launch Alpine Linux 3.3.x on Amazon Web Services

Launch_Alpine_Linux_3.3.x_on_AWS.md

Create a local VM of Alpine Linux, eg: https://gist.github.com/kennwhite/959d47a77070d365ad60

  • On your workstation open a terminal and create a new ssh keypair:

    ssh-keygen -t rsa -b 4096 -C "alpine@example.com"

    • Set a meaningful keypair base file name when prompted, eg: alpine-test
@jcs
jcs / asus c201.md
Last active April 17, 2024 17:44
Disabling SPI write protection, reflashing, and unbricking an Asus Chromebook C201

####Disabling SPI write protection

Put the Chromebook in developer-mode:

  • With machine powered off, hold down Esc and Refresh(F3) while hitting power button
  • At warning prompt, hit Control+D, then Enter at prompt about enabling developer mode
  • Machine will format itself

Now remove the write-protect screw to enable flashrom to flash new Coreboot/Libreboot.

Flip powered-off machine over and remove 8 philips-head screws. 2 are located under rubber feet.

@thpham
thpham / haproxy.conf
Last active February 28, 2024 07:41
test config haproxy for gRPC loadbalancing
global
tune.ssl.default-dh-param 1024
defaults
timeout connect 10000ms
timeout client 60000ms
timeout server 60000ms
frontend fe_http
mode http
@nh2
nh2 / time-natural.hs
Created March 1, 2014 01:33
Natural time in Haskell: `2 hours + 4 seconds`
{-# LANGUAGE FlexibleInstances, GeneralizedNewtypeDeriving #-}
newtype TimeUnit = TimeUnit Integer -- how many microseconds
deriving (Eq, Show, Num)
instance Num (TimeUnit -> TimeUnit) where
fromInteger n = \(TimeUnit scale) -> TimeUnit (n * scale)
-- a + b = ... -- task for you
@aktau
aktau / avg.scala
Created July 29, 2013 08:38
benchmark averaging methods
def movingRunningApprox(window: Int, l: Seq[Int]) = {
val N = window
val seedrun = l.take(N)
var avg = seedrun.sum / seedrun.length
println(l)
val xs = l map { el =>
val (pre,dec,inc) = (avg,avg/N,el/N)
avg = avg - avg/N + el/N