Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Mateusz Kubuszok MateuszKubuszok

🏠
Working from home
Block or report user

Report or block MateuszKubuszok

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@MateuszKubuszok
MateuszKubuszok / 0s.dat
Created Feb 4, 2014
MathProg: calculate mixed strategies Nash equilibrium (2 players, 0-sum game)
View 0s.dat
data;
set P1S := a b c;
set P2S := 1 2 3 4;
param Payoff
: 1 2 3 4 :=
a -5 3 1 8
b 5 5 4 6
c -4 6 0 5;
@MateuszKubuszok
MateuszKubuszok / n0s.dat
Created Feb 4, 2014
MathProg: calculate mixed strategies Nash equilibrium (any 2 players game)
View n0s.dat
data;
set P1S := a b c;
set P2S := 1 2 3 4;
param Payoff1
: 1 2 3 4 :=
a 0 3 1 8
b 5 5 4 6
c 2 6 0 5;
@MateuszKubuszok
MateuszKubuszok / all.gyp
Created Mar 2, 2015
Modified all.gyp (for building target base only)
View all.gyp
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
{
'variables': {
# A hook that can be overridden in other repositories to add additional
# compilation targets to 'All'.
'app_targets%': [],
# For Android-specific targets.
View OptMapOps.scala
implicit final class OptMapOps[A](self: A) {
def optMap[B, C >: A](otherOpt: Option[B])(f: (A, B) => C): C = otherOpt match {
case Some(other) => f(self, other)
case None => self
}
}
// sequence.mapOps(optionalFilter) { case (seq, filter) => filter(seq) }.otherOps(args)
View another_lambda.sh
#!/bin/bash
apply1() (
body=$2
block() {
eval "$body"
}
block "$1"
)
View part of Settings.sbt
// Android
packagingOptions in Android := PackagingOptions(Nil, Nil, Seq("META-INF/NOTICE.txt", "META-INF/LICENSE.txt")),
platformTarget in Android := "android-23",
minSdkVersion in Android := "23",
targetSdkVersion in Android := "23",
debugIncludesTests in Android := false,
dexMulti in Android := true,
typedResources in Android := false,
// Proguard
@MateuszKubuszok
MateuszKubuszok / build.sh
Created Jul 26, 2018
Publishing and testing Jekyll sites
View build.sh
#!/bin/bash --login
ThisDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$ThisDir/.."
if [ ! `command -v jekyll > /dev/null` ]; then
rvm use default ruby
bundle install
fi
@MateuszKubuszok
MateuszKubuszok / Dockerfile
Created Sep 26, 2018
Docker without root owning all files created outside
View Dockerfile
FROM anapsix/alpine-java:8_jdk
RUN apk add su-exec
COPY entrypoint.sh /usr/local/bin/entrypoint.sh
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
WORKDIR /build
View ReverseState.scala
// based on http://pavkin.ru/reverse-state-monad-in-scala-is-it-possible/
import $ivy.`org.typelevel::cats-core:1.4.0`, cats._, cats.implicits._
//import $plugin.$ivy.`org.spire-math::kind-projector:0.9.4`
//import $plugin.$ivy.`com.olegpy::better-monadic-for:0.2.4`
///
{
class ReverseState[S, A](val runF: Eval[Eval[S] => (Eval[S], Eval[A])]) {
@MateuszKubuszok
MateuszKubuszok / parser_combinators.scala
Created Mar 18, 2019
Simple parser combinators example
View parser_combinators.scala
// Parser definitions
type Parser[+A] = String => Option[(A, String)]
object Parser{
def apply[A](re: String)(f: String => A): Parser[A] =
input => s"""\\s*($re)(\\s*)""".r
.findPrefixMatchOf(input)
.map { n =>
You can’t perform that action at this time.