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
alias: Call Samsung TV on HomeKit Remote key presses | |
description: '' | |
trigger: | |
- platform: event | |
event_type: homekit_tv_remote_key_pressed | |
event_data: {} | |
condition: [] | |
action: | |
- service: media_player.play_media | |
data_template: |
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 class MapDifferenceResult( | |
updatedValues: Map[String, String], | |
newValues: Map[String, String] | |
) | |
def findMapDifferences( | |
newMap: Map[String, String], | |
oldMap: Map[String, String] | |
): MapDifferenceResult = { | |
val (updatedValues, newValues) = |
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
// Formula designed by Anrea Pinos | |
def fibonacci(n: Int): BigInt = { | |
n match | |
case n if (n % 4) == 0 => fibonacci((n + 2) / 2) * (fibonacci(n / 2) + fibonacci((n / 2) - 2)) + 1 | |
case n if (n % 4) == 1 => fibonacci((n - 1) / 2) * (fibonacci((n - 1) / 2) + fibonacci(2 + (n - 1) / 2)) + 1 | |
case n if (n % 4) == 2 => fibonacci((n - 2) / 2) * (fibonacci(n / 2) + fibonacci((n / 2) + 2)) + 1 | |
case n if (n % 4) == 3 => fibonacci((n - 1) / 2) * (fibonacci((n - 1) / 2) + fibonacci(2 + (n - 1) / 2)) - 1 | |
} |
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
/* | |
* Demonstration of fast Fibonacci algorithms (Java) | |
* by Project Nayuki, 2017. Public domain. | |
* https://www.nayuki.io/page/fast-fibonacci-algorithms | |
*/ | |
import java.math.BigInteger; | |
public final class FastFibonacci { |
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
-- [1,4,2,2,2,1] -> [2,3,0,1,0,0,...] | |
histogram :: [Int] -> [Int] | |
histogram xs = helper xs 1 | |
helper :: [Int] -> Int -> [Int] | |
helper list index = (count list index) : (helper list (index+1)) | |
count :: [Int] -> Int -> Int | |
count list element = length(filter (==element) list) |
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
strings :: [String] | |
strings = ["1:1", "1:10", "10:2"] | |
-- 1 - ничья (1:1) | |
-- 0 - поражение (0:2) | |
-- 2 - победа (3:0) | |
result :: Int | |
result = 0 |
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
#cloud-config | |
hostname: lamp.rsm-live.de | |
locale: 'de_DE.UTF-8' | |
runcmd: | |
- "cd /root" | |
- "locale-gen" | |
- "export LANG=de_DE.UTF-8" | |
- "export LC_ALL=de_DE.UTF-8" | |
- "curl -O https://apt.puppetlabs.com/puppet6-release-bionic.deb" | |
- "dpkg -i puppet6-release-bionic.deb" |
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
object Main { | |
def main(args: Array[String]) { | |
val points: List[Int] = Lesson.points | |
var sequences = (Lesson.chr1, Lesson.chr2) | |
def crossingOver(first: List[Char], second: List[Char], start: Int) = | |
first.zip(second).zipWithIndex.map( x => if (x._2 >= start) x._1.swap else x._1).unzip | |
points.foreach(i => { sequences = crossingOver(sequences._1, sequences._2, i) }) |
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
USE task2; | |
DROP TABLE IF EXISTS course; | |
DROP TABLE IF EXISTS student; | |
DROP TABLE IF EXISTS teacher; | |
DROP TABLE IF EXISTS marks; | |
DROP TABLE IF EXISTS group; | |
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
fibonacci :: Integer -> Integer | |
fibonacci 0 = 0 | |
fibonacci n | |
| n > 0 = helper (n-1) 0 1 | |
| otherwise = helper (n+1) 0 1 | |
helper :: Integer -> Integer -> Integer -> Integer | |
helper 0 prev cur = cur | |
helper term prev cur | |
| term > 0 = helper (term - 1) (cur) (prev + cur) |
NewerOlder