Default keyboard shortcuts for Ghostty terminal emulator. Platform-specific differences are noted where applicable.
Action | Windows/Linux | macOS |
---|---|---|
New window | Ctrl+Shift+N | Cmd+N |
Close window | Alt+F4 | Cmd+Shift+W |
import argparse | |
import boto3 | |
import os | |
import threading | |
from fnmatch import fnmatch | |
# S3 multi-part upload parts must be larger than 5mb | |
MIN_S3_SIZE = 6000000 | |
LOG_LEVEL = 'INFO' |
import scala.concurrent.Future | |
implicit val ec = scala.concurrent.ExecutionContext.global | |
def future(name: String): Future[String] = { | |
println(s"constructing $name") | |
Future { | |
Thread.sleep(1000) | |
println(s"resolved $name") | |
name |
Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.
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
/** | |
* We need to create bidirectional maps for items having both a name an an id | |
* When we collect items, we need to check that there are no duplicated names or ids for a given item | |
*/ | |
// first let's define bi-directional maps | |
case class BiMap[K, V](keys: Map[K, V], values: Map[V, K]) { | |
def add(entry: BiMapEntry[K, V]): BiMap[K, V] = | |
BiMap(keys + (entry.key -> entry.value), values + (entry.value -> entry.key)) |
import java.io._ | |
import java.util.zip._ | |
import scala.io.Source | |
var in = new GZIPInputStream(new FileInputStream("test.gz")) | |
// write setup in different objects to close later properly (important for big files ) | |
var fos = new FileOutputStream("test2.gz") | |
var gzos = new GZIPOutputStream( fos ) | |
var w = new PrintWriter(gzos) |