Skip to content

Instantly share code, notes, and snippets.

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

Marwen Ounis onixus74

🔮
Currently enchanting distributed systems with ML magic 🧪🔮💻
  • Copia Wealth Studios
  • Montreal
View GitHub Profile
@onixus74
onixus74 / Liveview upload s3 china example.md
Last active May 29, 2022 01:32 — forked from goofansu/app.js
Liveview upload directly to AWS China S3

LiveView upload directly to AWS China S3

@onixus74
onixus74 / README.md
Created October 25, 2021 14:05 — forked from petermueller/README.md
Phoenix + esbuild + yarn + postcss + tailwindcss + cpx2

Getting started

If you just want to copy-paste this it should "just work", but you'll need to get yarn set up. Follow the instructions at https://yarnpkg.com/getting-started/install OR just run:

  • npm install -g yarn
  • yarn set version berry
  • yarn install # this should make a .yarn/, yarn.lock, and .pnp.js

Mix Tasks

If you want to run these outside of the context of a running phoenix server, you can also run the mix tasks, mix assets.install and mix assets.compile. They are a copy paste of some the CLI bits but you could abstract them out to point to a config/cmds.exs or something if you wanted.

esbuild

@onixus74
onixus74 / model.ex
Created April 15, 2021 18:35 — forked from narrowtux/model.ex
Recursive models with ecto
defmodule Model do
schema "models" do
field :foo, :string
has_many :children, Model, foreign_key: :parent_id
belongs_to :parent, Model, foreign_key: :parent_id
end
@doc """
Recursively loads parents into the given struct until it hits nil
"""
Here's how to make jQuery DataTables work with npm and webpack. DT checks for AMD compatibility first
which breaks when you're using CommonJS with webpack.
Install DT core: npm install datatables.net
Install a DT style: npm install datatables.net-bs (bootstrap)
Install the imports-loader webpack plugin: https://github.com/webpack/imports-loader#disable-amd
Create a loader "exception" just for DT in webpack.config.js:
module: {
loaders: [
@onixus74
onixus74 / jquery-datatables-webpack
Created March 16, 2020 19:19 — forked from obonyojimmy/jquery-datatables-webpack
DataTables.net with webpack
Here's how to make jQuery DataTables work with npm and webpack. This is the simplest way I found to do it.
See the previous revision of this gist for a way to do it with forcing AMD to be disabled if you need that.
Install DT core: npm install datatables.net
Install a DT style: npm install datatables.net-dt
Then to initialize DT in your app, do this in your main entry point:
// you can use import or require
import dt from 'datatables.net';
@onixus74
onixus74 / iso-3166-1_codes.ex
Created March 12, 2020 14:13 — forked from delameko/iso-3166-1_codes.ex
ISO 3166-1 (alpha 2) country codes, in an Elixir list
country_codes = [
%{ iso_3166_1: "AF", name: "Afghanistan" },
%{ iso_3166_1: "AX", name: "Aland Islands" },
%{ iso_3166_1: "AL", name: "Albania" },
%{ iso_3166_1: "DZ", name: "Algeria" },
%{ iso_3166_1: "AS", name: "American Samoa" },
%{ iso_3166_1: "AD", name: "Andorra" },
%{ iso_3166_1: "AO", name: "Angola" },
%{ iso_3166_1: "AI", name: "Anguilla" },
%{ iso_3166_1: "AQ", name: "Antarctica" },
@onixus74
onixus74 / install_anaconda.md
Created January 28, 2020 16:27 — forked from kauffmanes/install_anaconda.md
Install Anaconda on Windows Subsystem for Linux (WSL)

Note: $ denotes the start of a command. Don't actually type this.

Steps to Install Anaconda on Windows Ubuntu Terminal

  1. Install WSL (Ubuntu for Windows - can be found in Windows Store). I recommend the latest version (I'm using 18.04) because there are some bugs they worked out during 14/16 (microsoft/WSL#785)
  2. Go to https://repo.continuum.io/archive to find the list of Anaconda releases
  3. Select the release you want. I have a 64-bit computer, so I chose the latest release ending in x86_65.sh. If I had a 32-bit computer, I'd select the x86.sh version. If you accidentally try to install the wrong one, you'll get a warning in the terminal. I chose Anaconda3-5.2.0-Linux-x86_64.sh.
  4. From the terminal run wget https://repo.continuum.io/archive/[YOUR VERSION]. Example: $ wget https://repo.continuum.io/archive/Anaconda3-5.2.0-Linux-x86_64.sh
  5. Run the installation script: $ bash Anaconda[YOUR VERSION].sh ($ bash Anaconda3-5.2.0-Linux-x86_64.sh)
  6. Read the license
diff --git a/assets/js/App.svelte b/assets/js/App.svelte
new file mode 100644
index 0000000..221cde6
--- /dev/null
+++ b/assets/js/App.svelte
@@ -0,0 +1,5 @@
+<script>
+ export let name;
+</script>
@onixus74
onixus74 / .tmux.conf
Last active September 9, 2022 21:33 — forked from gblmarquez/.tmux.conf
.tmux.conf with fish as default shell
#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
set -g default-terminal "screen-256color"
set-option -sg escape-time 10
set-option -g default-terminal "screen-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: