Map [1]
| Operation | Time Complexity |
|---|---|
| Access | O(log n) |
| Search | O(log n) |
| Insertion | O(n) for <= 32 elements, O(log n) for > 32 elements [2] |
| Deletion | O(n) for <= 32 elements, O(log n) for > 32 elements |
| import libtorrent as lt | |
| # usage: | |
| # sudo apt install python3-libtorrent | |
| # wget https://thenftbay.org/billion-dollar-nft-torrent.torrent | |
| # python3 t.py | |
| info = lt.torrent_info("billion-dollar-nft-torrent.torrent") | |
| print("Number of pieces: ", info.num_pieces()) | |
| print("dumping piece hashes:") |
| Here's a quick dockerfile: | |
| ----------------8<-------------[ cut here ]------------------ | |
| FROM debian:latest | |
| RUN apt-get update && apt-get install -y nodejs npm | |
| ----------------8<-------------[ cut here ]------------------ | |
| save that as Dockerfile and do: docker build -t node-builder . | |
| #!/usr/bin/python3 | |
| from sseclient import SSEClient | |
| import json | |
| from math import sqrt | |
| import winsound # NOTE: Windows only | |
| from datetime import datetime, timezone, timedelta | |
| ''' | |
| Version 2.1 (2023-07-07): A small script that alerts the user of lightning if it strikes within 16 km (10 miles) of your home position in the Nordics. | |
| Based on lightning observations broadcast as SSE from The Norwegian Meteorological Institute, https://www.met.no/. |
This is inspired by A half-hour to learn Rust and Zig in 30 minutes.
Your first Go program as a classical "Hello World" is pretty simple:
First we create a workspace for our project:
| #!/bin/bash | |
| while :; do | |
| verf=$(cat /dev/urandom | tr -dc '0-9' | fold -w 8 | head -n 1) | |
| pin=$(cat /dev/urandom | tr -dc '0-9' | fold -w 5 | head -n 1) | |
| ip=$(printf "%d.%d.%d.%d\n" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))" "$((RANDOM % 256))") | |
| {-# LANGUAGE GADTSyntax #-} | |
| {-# LANGUAGE DeriveFoldable #-} | |
| module Tree where | |
| import Control.Monad | |
| import Data.Maybe | |
| import Data.Foldable | |
| data T a = L | N (T a) a (T a) deriving (Show, Foldable) |
| -- Many faces of isOrderedTree | |
| -- Code to the talk (extended version) | |
| {-# LANGUAGE DeriveFoldable #-} | |
| module Tree where | |
| import Control.Monad | |
| import Data.Maybe | |
| import Data.Foldable |
See also List of materials about Software Design in Haskell
| Junior | Middle | Senior | Architect | |
|---|---|---|---|---|
| Haskell level | Basic Haskell | Intermediate Haskell | Advanced Haskell | Language-agnostic |
| Haskell knowledge scope | Learn you a Haskell | Get programming with Haskell | Haskell in Depth | Knows several languages from different categories |
| Get programming with Haskell | Haskell in Depth | Functional Design and Architecture | ||
| Soar with Haskell | [Soar |
| import scala.util.Try | |
| /** | |
| * Alternative to unsound construct: "sealed abstract case class" | |
| * see https://gist.github.com/tpolecat/a5cb0dc9adeacc93f846835ed21c92d2 | |
| * The solution below is the summary of the comments of the above gist. | |
| * | |
| * Works as is in Scala 2.12 and higher | |
| * In Scala 2.11.12 you have to add -Xsource:2.12 | |
| */ |