This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// new | |
/*M/////////////////////////////////////////////////////////////////////////////////////// | |
// | |
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING. | |
// | |
// By downloading, copying, installing or using the software you agree to this license. | |
// If you do not agree to this license, do not download, install, | |
// copy or use the software. | |
// | |
// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
class Ron | |
def initialize(name, left_fork, right_fork) | |
@name = name | |
@left_fork = left_fork | |
@right_fork = right_fork | |
while true | |
think | |
dine |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad | |
import Control.Concurrent | |
import Control.Concurrent.STM | |
import System.Random | |
import Text.Printf | |
-- Forks | |
type Fork = TMVar Int | |
newFork :: Int -> IO Fork |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Control.Monad.Reader | |
hello :: Reader String String | |
hello = do | |
name <- ask | |
return ("hello, " ++ name ++ "!") | |
bye :: Reader String String | |
bye = do | |
name <- ask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE EmptyDataDecls #-} | |
{-# LANGUAGE FlexibleContexts #-} | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE QuasiQuotes #-} | |
{-# LANGUAGE TemplateHaskell #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
{-# OPTIONS_GHC -fno-warn-orphans #-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% scaled features. | |
% x = square feet | |
% y = sale price | |
x = [1, 2, 4]; | |
y = [2, 2.5, 3]; | |
% function to calculate the predicted value | |
function result = h(x, t0, t1) | |
result = t0 + t1 * x; | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi Mayor Carter, | |
Like many citizens of Saint Paul, I've been glued to the news this week. As protests spread from Minneapolis to Saint Paul, I've been shocked at how cops are ESCALATING this situation instead of DE-ESCALATING it. | |
We need police reform, and training is not enough. | |
I want to show you what a cop told me. | |
"The training involved lecture, personal testimony from people who have had crisis interactions with police, and role-playing scenarios, in which the cops are tested. They generally did not do well. Many didn’t take the training seriously. Most don’t respond well to being challenged. They want to be obeyed. They want total control. People in crisis rarely give them that, and things tend to escalate. The cops are taught how to deescalate situations, using techniques such as mirroring, silence, and modulating the tempo. But, as I said, many of them consider this stuff bullshit. A culture change is necessary, from the top down and from the ground up. A big help would be if cops were legally held |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi Governor Walz and Lt Governor Flanagan, | |
Like many citizens of the Twin Cities, I've been glued to the news this week. I want to let you know I'm so thankful that Chauvin got arrested. | |
Now he needs to be convicted and go to jail. | |
I've seen again and again that the police get let off with a slap on the wrist. This does not work. | |
I want to show you what a cop told me. | |
"The training involved lecture, personal testimony from people who have had crisis interactions with police, and role-playing scenarios, in which the cops are tested. They generally did not do well. Many didn’t take the training seriously. Most don’t respond well to being challenged. They want to be obeyed. They want total control. People in crisis rarely give them that, and things tend to escalate. The cops are taught how to deescalate situations, using techniques such as mirroring, silence, and modulating the tempo. But, as I said, many of them consider this stuff bullshit. A culture change is necessary, from the top down and from the grou |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'thread' | |
class Waiter | |
def initialize | |
@mutex = Mutex.new | |
end | |
def can_eat? philosopher | |
left = philosopher.left_fork | |
right = philosopher.right_fork |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% data | |
x = [1, 2, 3, 4, 5, 6]; | |
y = [0, 0, 0, 1, 1, 1]; | |
% function to calculate the predicted value | |
function result = h(x, t0, t1) | |
result = sigmoid(t0 + t1 * x); | |
end | |
% sigmoid function |
NewerOlder