Skip to content

Instantly share code, notes, and snippets.

View onixus74's full-sized avatar
🔮
Enchanting distributed systems with ML magic 🧪🔮💻

Marwen Ounis onixus74

🔮
Enchanting distributed systems with ML magic 🧪🔮💻
  • Copia Wealth Studios
  • Montreal
View GitHub Profile
#set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'
# Add truecolor support
set-option -ga terminal-overrides "xterm-256color:Tc"
# Default terminal is 256 colors
# Default terminal is 256 colors
# set -g default-terminal "screen-256color"
# OR (With italics)
set -g default-terminal "xterm-256color"
@onixus74
onixus74 / _readme.md
Created December 23, 2019 18:30 — forked from mislav/_readme.md
tmux-vim integration to transparently switch between tmux panes and vim split windows

I use tmux splits (panes). Inside one of these panes there's a Vim process, and it has its own splits (windows).

In Vim I have key bindings C-h/j/k/l set to switch windows in the given direction. (Vim default mappings for windows switching are the same, but prefixed with C-W.) I'd like to use the same keystrokes for switching tmux panes.

An extra goal that I've solved with a dirty hack is to toggle between last active panes with C-\.

Here's how it should work:

@onixus74
onixus74 / init.vim
Last active October 20, 2024 20:46 — forked from benawad/init.vim
vim-like-vscode
" VIM-VSCODE
"*****************************************************************************
" VIM-PLUG CORE
"*****************************************************************************
let vimplug_exists=expand('~/.config/nvim/autoload/plug.vim')
let g:vim_bootstrap_langs = "elixir,eelixir,html,javascript,typescript,python,ruby,yaml"
let g:vim_bootstrap_editor = "nvim" " nvim or vim
@onixus74
onixus74 / hack.sh
Created December 20, 2019 21:02 — forked from hpcsc/hack.sh
md viewer in terminal
#!/usr/bin/env bash
FZF_DEFAULT_OPTS="--reverse --height 30% --header 'Choose markdown file'"
CACHE_DIR=$HOME/.hack/
function check_prerequisite() {
local prerequisites=(curl mdless jq fzf)
for tool in ${prerequisites[@]}; do
type ${tool} >/dev/null 2>&1 || { echo >&2 "I require $tool but it's not installed."; exit 1; }

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@onixus74
onixus74 / Map.Helpers
Created October 22, 2019 15:33 — forked from kipcole9/Map.Helpers
Helpers for Elixir Maps: underscore, atomise and stringify map keys
defmodule Map.Helpers do
@moduledoc """
Functions to transform maps
"""
@doc """
Convert map string camelCase keys to underscore_keys
"""
def underscore_keys(nil), do: nil

The Complete Guide to Nested Forms in Phoenix

I recently spent some time dealing with nested forms in Phoenix. Nested forms are great when you want to create multiple database records in a single transaction and associate them with each other. I am new to Phoenix and really struggled to find any resources that helped me with my specific problem. I decided to document what I learned in the process in hopes of helping others that are new to Elixir and Phoenix.

Here is my attempt at a one stop shop to learn everything you will need to know about nested forms. If you would like to view the GitHub repo you can check it out here.

Thanks to Heartbeat and Jose for excellent blog posts on nested forms. Also shoutout to Josh for showing me some examples at Ruby

t = [1,1,2,2,3]
f = fn(n) ->
IO.puts("starting #{n}")
:timer.sleep(n * 1000)
IO.puts("finishing #{n}")
n
end
tasks = Enum.map(t, fn(n) ->
@onixus74
onixus74 / Dockerfile Elixir
Created June 21, 2019 19:23 — forked from bdubaut/Dockerfile Elixir
Elixir/Phoenix docker-compose setup
FROM elixir:1.5.3-alpine
WORKDIR /app
ADD . /app
# Install hex & rebar
RUN mix local.hex --force && \
mix local.rebar --force && \
mix hex.info
@onixus74
onixus74 / Dockerfile
Created June 19, 2019 14:59 — forked from wmnnd/Dockerfile
Elixir Dockerfile Boilerplate
#===========
#Build Stage
#===========
FROM bitwalker/alpine-elixir:1.5 as build
#Copy the source folder into the Docker image
COPY . .
#Install dependencies and build Release
RUN export MIX_ENV=prod && \