Skip to content

Instantly share code, notes, and snippets.

set nru
set incsearch
set clipboard=unnamedplus,unnamed
let mapleader = ","
" Mappings are made of action group prefix - action
" Find
nmap <Leader>f :action Find<CR> " default IDEA search
nmap <Leader>ff :action FindModal<CR>
@john-eevee
john-eevee / emoji_on_suse
Created August 19, 2019 03:07
steps to get emoji on suse
- download & extract from https://github.com/eosrei/twemoji-color-font/releases
- install bitstream with `sudo zypper in bitstream-vera-fonts`
- cd TwitterColorEmoji-SVGinOT-Linux-12.0.1
- chmod +x install.sh && ./install.sh
@john-eevee
john-eevee / capsctrl.ahk
Created July 30, 2019 15:00
map capslock to ctrl and esc using autohotkey
*CapsLock::
Send {Blind}{Ctrl Down}
cDown := A_TickCount
Return
*CapsLock up::
; Modify the threshold time (in milliseconds) as necessary
If ((A_TickCount-cDown) < 210)
Send {Blind}{Ctrl Up}{Esc}
Else
@john-eevee
john-eevee / akka_http_and_cats_validation.md
Created June 30, 2019 04:18 — forked from melvic-ybanez/akka_http_and_cats_validation.md
Request Validation with Akka-HTTP and Cats

Request Validation with Akka-HTTP and Cats

Greg Beech wrote an article on Akka HTTP Entity Validation. This post is on the same topic, except we are going to use typeclass instances, as opposed to subtyping, for form validations.

Sample Problem: User Regsitration

To start with, let us suppose that we are working on some sort of user management service using Scala/Akka. However, here we are only going to focus on the registration part, in which the client is expected to send a user data, in JSON format; and the server needs to validate them, and save the user if the validations succeed, or reject the request with all the errors detected. That said, we should keep in mind that our validations may be used through out the entire codebase, not just in the user registration endpoint.

The rules for our validation are as follows:

@john-eevee
john-eevee / akka_http_and_cats_validation.md
Created June 30, 2019 04:18 — forked from melvic-ybanez/akka_http_and_cats_validation.md
Request Validation with Akka-HTTP and Cats

Request Validation with Akka-HTTP and Cats

Greg Beech wrote an article on Akka HTTP Entity Validation. This post is on the same topic, except we are going to use typeclass instances, as opposed to subtyping, for form validations.

Sample Problem: User Regsitration

To start with, let us suppose that we are working on some sort of user management service using Scala/Akka. However, here we are only going to focus on the registration part, in which the client is expected to send a user data, in JSON format; and the server needs to validate them, and save the user if the validations succeed, or reject the request with all the errors detected. That said, we should keep in mind that our validations may be used through out the entire codebase, not just in the user registration endpoint.

The rules for our validation are as follows:

@john-eevee
john-eevee / gist:da2a7a613e62f3f4372b5590d6a4485f
Created June 1, 2019 04:30 — forked from pbailis/gist:5660980
Assorted distributed database readings

Context: I was asked for a list of interesting reading relating to "distributed databases, behavior under partitions and failures, failure detection." Here's what I came up with in about an hour.

For textbooks, "Introduction to Reliable and Secure Distributed Programming" is a superb introduction to distributed computing from a formal perspective; it's really not about "programming" or "engineering" but about distributed system fundamentals like consensus, distributed registers, and broadcast. Used in Berkeley's Distributed Computing course (and HT to @lalithsuresh) Book Site

Notes from courses like Lorenzo Alvisi's Distributed Computing class can be great.

There are a bunch of classics on causality, [Paxos](ht

@john-eevee
john-eevee / Consecutive.exs
Created May 18, 2019 18:38
check if two elements are consecutive
defmodule Consecutive do
defp consecutive([]) do
false
end
defp consecutive([a | [a | _rest]]) do
true
end
@john-eevee
john-eevee / permutation.exs
Created May 18, 2019 18:35
Generate Permutations on List
defmodule Permutation do
def permutations([]), do: [[]]
def permutations(list),
do: for(elem <- list, rest <- permutations(list -- [elem]), do: [elem | rest])
end
@john-eevee
john-eevee / inventory.exs
Created May 18, 2019 18:12
Freecodecamp Inventory Update in Elixir
defmodule FCCL.Algos.Inventory do
@doc """
## Examples
iex> current = [[21, "Bowling Ball"], [2, "Dirty Sock"], [1, "Hair Pin"], [5, "Microphone"]]
iex> new = [[2, "Hair Pin"], [3, "Half-Eaten Apple"], [67, "Bowling Ball"], [7, "Toothpaste"]]
iex> FCCL.Algos.Inventory.update(current, new)
[[88, "Bowling Ball"], [2, "Dirty Sock"], [3, "Hair Pin"], [3, "Half-Eaten Apple"], [5, "Microphone"], [7, "Toothpaste"]]
"""
def update(current, new) do
[credential]
helper = manager
[user]
name = João Pedro de Carvalho
email = evangelistajoaop@gmail.com
[core]
excludesfile = ~/dotgit/.gitignore
[commit]
template = ~/dotgit/.gitmessage