This file contains 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 Knapsack { | |
val W = 10000 // capacity | |
val n = 100 // number of items | |
val file = "path-to-your-file-contains-<size> <weight> lines" | |
val c = Array.ofDim[Int](n, W) | |
val lines = Source.fromFile(file).getLines.drop(1).toList.map(_.split(" ").map(_.toInt)) | |
def main(args: Array[String]) { | |
0 until W foreach { x => c(0)(x) = 0 } | |
for (i <- 1 until n; x <- 0 until W) c(i)(x) = math.max(c(i - 1)(x), { if (lines(i)(1) > x) 0 else c(i - 1)(x - lines(i)(1)) + lines(i)(0) }) | |
print(c(n-1)(W-1)) |
This file contains 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;31m | |
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy | |
yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy | |
yyyyy/ +yyyyyyyyyyyyyy+ +y///y | |
yyyyy/ /yyyyyyyyyyyyyyyy: +yo+oy | |
yyyyy/ -yyyyyyyyyyyyyyyyyy- +yyyyy | |
yyyyy/ .syyyyyyyyyyyyyyyyyys. +yyyyy | |
yyyyy/ `syyyyyyyyyyyyyyyyyyyys` +yyyyy | |
yyyyy/ `oyyyyyyyyyyyyyyyyyyyyyy+` +yyyyy | |
yyyyy/ +yyyyyyyyyyyyyyyyyyyyyyyy/ +yyyyy |
This file contains 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 io.moo.training.akka | |
import akka.actor.{Actor, Props} | |
class CounterActor extends Actor { | |
var counter: Int = 0 | |
override def receive: Receive = { | |
case "incr" => counter += 1 | |
case "get" => sender ! counter |
This file contains 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
def get_numpy_data(data_sframe, features, output): | |
data_sframe['constant'] = 1 # this is how you add a constant column to an SFrame | |
# add the column 'constant' to the front of the features list so that we can extract it along with the others: | |
features = ['constant'] + features # this is how you combine two lists | |
# select the columns of data_SFrame given by the features list into the SFrame features_sframe (now including constant): | |
features_sframe = data_sframe[features] | |
# the following line will convert the features_SFrame into a numpy matrix: | |
feature_matrix = features_sframe.to_numpy() | |
# assign the column of data_sframe associated with the output to the SArray output_sarray | |
output_sarray = data_sframe['price'] |
This file contains 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 io.ryos.demos.fibers; | |
import static java.lang.System.out; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.SynchronousQueue; | |
public class FiberDemo { |
This file contains 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 io.ryos.demos.continuations; | |
import static java.lang.System.out; | |
import java.util.Arrays; | |
import java.util.List; | |
public class ContinuationDemo { | |
public static void main(String[] args) { | |
var scope = new ContinuationScope("my-scope"); |
This file contains 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
# The meeting matrix can be improved with constraints e.g output has minimum waiting person and | |
# shortest total duration by using constraing programming or linear optimization. | |
# The problem is very similar to N-Queens. | |
# Right now you can find optimum solution by running the code multiple times. | |
import itertools | |
import random | |
from datetime import datetime, timedelta | |
team = ['Erhan', 'Brown', 'Mustermann', 'Jack', 'Joe', 'Rambo', 'Steve'] |
This file contains 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 io.ryos.rhino.sdk.simulations; | |
import static io.ryos.rhino.sdk.dsl.specs.DSLSpec.http; | |
import static io.ryos.rhino.sdk.dsl.specs.HttpSpec.from; | |
import static io.ryos.rhino.sdk.dsl.specs.UploadStream.file; | |
import static io.ryos.rhino.sdk.dsl.specs.builder.SessionAccessor.session; | |
import static io.ryos.rhino.sdk.utils.TestUtils.getEndpoint; | |
import io.ryos.rhino.sdk.SimulationConfig; | |
import io.ryos.rhino.sdk.annotations.Dsl; |
This file contains 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
@RampUp(startRps = 1, targetRps = 60, durationInMins = 1) | |
ohne max. connection und mit 1 sec response zeit, | |
würde sowas erwarten: | |
10s 20s 30s 40s 50s 60s | |
55 210 465 820 1275 1830 | |
weil pro Sekunde, +1 request Anstieg: | |
1s 2s 3s ... 10s | |
1 2 3 10 = 55 total | |
This file contains 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
sudo defaults write bluetoothaudiod "Enable AptX codec" -bool true | |
sudo defaults read bluetoothaudiod |
OlderNewer