Skip to content

Instantly share code, notes, and snippets.

View MateuszKubuszok's full-sized avatar
🏠
Vacationing from OSS at an actual work

Mateusz Kubuszok MateuszKubuszok

🏠
Vacationing from OSS at an actual work
View GitHub Profile
@MateuszKubuszok
MateuszKubuszok / .dotsync.yml
Last active August 13, 2020 13:23
Utility for copying dotfiles from HOME to some backup directory e.g. git/Dropbox/etc
backup: .dotsync_bck
global:
include:
- .bashrc
- .zshrc
exclude: []
local:
laptop2:
include:
- .snxrc
Compiled from "Test2.scala"
public final class Test2$ {
public static final Test2$ MODULE$;
public static {};
Code:
0: new #2 // class Test2$
3: dup
4: invokespecial #20 // Method "<init>":()V
7: putstatic #22 // Field MODULE$:LTest2$;
Compiled from "Test1.scala"
public final class Test1$ {
public static final Test1$ MODULE$;
public static {};
Code:
0: new #2 // class Test1$
3: dup
4: invokespecial #18 // Method "<init>":()V
7: putstatic #20 // Field MODULE$:LTest1$;
@MateuszKubuszok
MateuszKubuszok / .tmux.conf
Created May 18, 2020 11:31
Poor man's iTerm2-like Tmux + Alacritty
# Open window/pane in the same PATH
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# Reload config
bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
# Window tab menu
bind-key -T root MouseDown3Status display-menu -T "#[align=centre]#{window_index}:#{window_name}" -t = -x W -y S \
"Swap Left" l "swap-window -t:-1" \
@MateuszKubuszok
MateuszKubuszok / ammonite.md
Last active October 14, 2021 09:51
Useful Ammonite snippets

Useful Ammonite snippets

All of these can be figured out by looking at ammonite.io and at libraries pages, but to make things faster for myself I written it down (I don't always want to search through Ammonite history nor pollute my ~/.ammonite/predef.sc).

For convenience, next to library there is badge with the newest version and next to one liners for Ammonite for specific version is link to releases - it let you update to newest version without goolging or checking project's site.

@MateuszKubuszok
MateuszKubuszok / Uncurry.scala
Created March 14, 2020 14:57
Sometimes I missed .uncurried cuntionality in Scala
trait Uncurry[C, U] {
def uncurried(curried: C): U
}
object Uncurry {
def instance[C, U](body: C => U) = new Uncurry[C, U] {
def uncurried(curried: C): U = body(curried)
}
implicit def uncurry2[A, B, Out]: Uncurry[A => B => Out, (A, B) => Out] =
instance[A => B => Out, (A, B) => Out] { curried => curried(_)(_) }
implicit def uncurry3[A, B, C, Out]: Uncurry[A => B => C => Out, (A, B, C) => Out] =
@MateuszKubuszok
MateuszKubuszok / .tmux.conf
Created January 4, 2020 14:09
Sane Tmux config which can be used with mouse and have nice copy/tiling/searching things turned on and added to right mouse button menu
# Open window/pane in the same PATH
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
# Reload config
bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."
# Window tab menu
bind-key -T root MouseDown3Status display-menu -T "#[align=centre]#{window_index}:#{window_name}" -t = -x W -y S \
"Swap Left" l "swap-window -t:-1" \
@MateuszKubuszok
MateuszKubuszok / parser_combinators.scala
Created March 18, 2019 14:54
Simple parser combinators example
// 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 =>
@MateuszKubuszok
MateuszKubuszok / ReverseState.scala
Last active November 19, 2018 10:33
ReverState in 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 / Dockerfile
Created September 26, 2018 11:07
Docker without root owning all files created outside
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