- Transpose
- Reverse each row
This file contains hidden or 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
/** | |
* Case Study: the Water Pouring Problem | |
* https://www.coursera.org/learn/progfun2/lecture/EkEqR/lecture-2-5-case-study-the-water-pouring-problem | |
* | |
* @param capacity defines how many glasses the problem is and their capacity | |
* index = glass Id | |
* value = capacity of the glass in ml | |
*/ | |
class Pouring(capacity: Vector[Int]) { |
This file contains hidden or 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
package floodIt | |
import floodIt._ | |
case class Pos(val x: Int, val y: Int) | |
class Blocks(val width: Int, val height: Int) { | |
private val data = Array.ofDim[Int](width, height) | |
resetData() | |
// Create initial pattern |
This file contains hidden or 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
package ScalaCalcSheet | |
import scala.math._ | |
trait Arithmetic { | |
this: Evaluator => | |
operations ++= List( | |
"sin" -> { case List(x) => sin(x) }, | |
"cos" -> { case List(x) => cos(x) }, |
This file contains hidden or 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 'dart:math'; | |
import 'package:flutter/material.dart'; | |
void main() { | |
return runApp( | |
MaterialApp( | |
home: Scaffold( | |
backgroundColor: Colors.red, | |
appBar: AppBar( | |
backgroundColor: Colors.red, |
This file contains hidden or 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 'package:flutter/material.dart'; | |
void main() { | |
return runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
This file contains hidden or 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
PI install (scroll down for docker) | |
1. install raspbian lite | |
2. setup ssh | |
3. change hostname | |
4. set static ip on router, see why you changed the hostname now ;) | |
5. $ curl -sSL https://install.pi-hole.net | bash | |
6. follow the prompts and get everything turned on. | |
- set upstream DNS, google 8.8.8.8 or cloudflare 1.1.1.1 | |
- use ipv4, ipv6 comes later | |
- enable the webinterface, we can script later |
This file contains hidden or 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
#!/usr/bin/env python3 | |
from mcpi.minecraft import Minecraft | |
# Подключаемся к серверу Minecraft - заменить SERVER_IP на реальный IP адрес сервера | |
mc = Minecraft.create('SERVER_IP') | |
# Пишем приветствие в чат | |
mc.postToChat("Hello world of Minecraft!") |