Skip to content

Instantly share code, notes, and snippets.

View julesvanrie's full-sized avatar

Jules van Rie julesvanrie

View GitHub Profile
@julesvanrie
julesvanrie / links.md
Last active December 6, 2024 11:02
Demo Q4 2024
@julesvanrie
julesvanrie / instructions.md
Last active March 10, 2024 18:46
SpySchema using docker inside a VM

Create a docker network on your VM

We will run postgres and SpySchema on this network

docker network create dbnet

Run postgres

docker run -d --name mypg \
@julesvanrie
julesvanrie / Power BI DAX examples.md
Created November 15, 2023 12:04
POWER BI DAX examples

DAX Measures, Calculate, Filter, All

  • Sales = SUM(SalesTable[Sales])
  • Sales A = CALCULATE([Sales], FILTER(SalesTable, SalesTable[Company]= "A"))
  • Share A = [Sales A] / [Sales]
  • Filter on A
  • Sales All = CALCULATE([Sales], ALL(SalesTable))
  • Change: Share A = [Sales A] / [Sales All]
  • Whoops, looks like we’re losing too much context (no date context anymore, all context was removed by using ALL).
  • Sales All Companies = CALCULATE([Sales], All(SalesTable[Company]))
@julesvanrie
julesvanrie / pipeline.py
Created November 13, 2023 10:01
scikit-learn preprocessing pipeline imports
# Pipeline elements for class instantiaton lovers
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn.compose import ColumnTransformer, make_column_selector
## Pipeline elements for make_functions lovers
from sklearn.pipeline import make_pipeline, make_union
from sklearn.compose import make_column_transformer, make_column_selector
## Preprocessing
# Imputing
@julesvanrie
julesvanrie / nanorc
Created November 2, 2023 17:53
nanorc
set tabsize 4
set tabstospaces
set autoindent
set trimblanks
set linenumbers
set constantshow
set titlecolor white,red
set keycolor cyan
set functioncolor cyan
set numbercolor yellow
@julesvanrie
julesvanrie / custom.js
Created October 23, 2023 13:46
Sublime key mapping for Jupyter
require(["codemirror/keymap/sublime", "notebook/js/cell", "base/js/namespace"],
function (sublime_keymap, cell, IPython) {
// setTimeout(function(){ // uncomment line to fake race-condition
cell.Cell.options_default.cm_config.keyMap = 'sublime';
cell.Cell.options_default.cm_config.extraKeys["Ctrl-Enter"] = function (cm) { }
cell.Cell.options_default.cm_config.extraKeys["Cmd-Enter"] = function (cm) { }
var cells = IPython.notebook.get_cells();
for (var cl = 0; cl < cells.length; cl++) {
@julesvanrie
julesvanrie / zshhistory.bash
Last active April 16, 2023 11:24
History formatted
# In case history -i would not work
# Scroll as much as you wish
# Type 'q' to quit
# On Ubuntu first execute the following line (default mawk doesn't support interval in regex)
# sudo apt install gawk
cat ~/.zsh_history | awk -F\; '{ match($1, /[0-9]{10}/, date); time=strftime("%F %T", date[0]); print(time, " ", substr($0, match($0, /;/)+1)) }' | less +G
@julesvanrie
julesvanrie / zprofile.bash
Created April 13, 2023 14:49
Lines to add to .zprofile (at the start) to find brew on M1 Mac
# In the terminal execute code ~/.zprofile
# Add the following lines at the beginning of the file:
# Required to find brew on Mac with Apple silicon
eval "$(/opt/homebrew/bin/brew shellenv 2> /dev/null)"
@julesvanrie
julesvanrie / whiterr.zsh-theme
Created March 25, 2023 15:48
My white zsh theme - based off robbyrussell
PROMPT="%{$fg[white]%}%T %(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )"
PROMPT+=' %{$fg[cyan]%}%2~%{$reset_color%} $(git_prompt_info)'
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗"
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})"
@julesvanrie
julesvanrie / multilabel_dataset.py
Created March 25, 2023 12:03
Using tf Dataset to prepare data for a multi head Keras model
from tensorflow.data import Dataset
AUTOTUNE = tf.data.AUTOTUNE
BATCH_SIZE = 64
TEST_SIZE = 0.1
VAL_SIZE = 0.3
RESIZE = 224
WIDTH = RESIZE
HEIGHT = RESIZE