(from Haskell training)
git checkout chapter2
Celsius recent court filings provided a terrible and arguably avoidable loss of privacy for many of its customers, and will likely have chilling ripple effects for a long time to come. The goal of this presentation-turned-writeup is to give some context so that the reader can understand the consequences of such incidents and where to find more detailed information in order to mitigate such risks, and the tradeoffs that entails.
// SPDX-License-Identifier: MIT | |
pragma solidity >=0.7.0 <0.9.0; | |
contract HelloWorld { // capital letter for contract name | |
string text_ = "Hello World"; | |
function helloworld() public view returns (string memory) { | |
//return text_; | |
bytes memory bm = helloTest(text_, "!!!"); | |
return string(bm); |
#!/usr/bin/env python3 | |
# Copyright (c) 2017-2021 The Bitcoin Core developers | |
# Distributed under the MIT software license, see the accompanying | |
# file COPYING or http://www.opensource.org/licenses/mit-license.php. | |
"""An example functional test | |
The module-level docstring should include a high-level description of | |
what the test is doing. It's the first thing people see when they open | |
the file and should give the reader information about *what* the test |
import Data.Char (intToDigit, digitToInt) | |
-- Ading 2 binary int with reminder | |
addB :: Int -> Int -> Int -> (Int, Int) | |
addB x y r = if z >= 2 then (1, z - 2) else (0, z) | |
where | |
z = x + y + r | |
-- recursive adder combining the 2 streams of Char and return the reversed combination | |
-- (Char -> Int) = convert Char to Int. It can be customise to add custom logic |
// simple flink job | |
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; | |
import org.apache.flink.streaming.api.datastream.DataStream; | |
import org.apache.flink.api.common.functions.FilterFunction; | |
public class Example { | |
public static StreamExecutionEnvironment getEnvironment(env: String) { | |
StreamExecutionEnvironment env; |
// Scala Bridge - Code to show how to declare type classes in Scala (from Scala with Cats) | |
sealed trait Json | |
final case class JsObject(get: Map[String, Json]) extends Json | |
final case class JsString(get: String) extends Json | |
final case class JsNumber(get: Double) extends Json | |
final case object JsNull extends Json | |
trait JsonWriter[A] { | |
def write(value: A): Json |
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
/** | |
* D Holbrook | |
* | |
* Code Club: PO1 | |
* | |
* (*) Define a binary tree data structure and related fundamental operations. | |
* | |
* Use whichever language features are the best fit (this will depend on the language you have selected). The following operations should be supported: | |
* | |
* Constructors |