Skip to content

Instantly share code, notes, and snippets.

View arnos-stuff's full-sized avatar
🎯
Focusing

Arno V arnos-stuff

🎯
Focusing
  • Some big IT & Data Consulting Corp @ La Défense (FR)
  • Paris
  • 17:02 (UTC +02:00)
  • X @varn0v
View GitHub Profile
@arnos-stuff
arnos-stuff / wsl-zsh-docker-compinit.md
Created November 28, 2022 04:49
Small tweak to the known fix to the vendor completion docker zsh wsl2 issue

The bug

As described in this github discussion the issue arises when you mix several things together

  • windows setup
  • runs wsl / wsl2
  • uses zsh as a shell on wsl
  • installed docker desktop

In these situations you will the 'vendor completion' /usr/share/zsh/vendor-completions/_docker because (supposedly)

@arnos-stuff
arnos-stuff / local-install.ps1
Created November 28, 2022 20:01
Install locally if no admin rights on windows machines without WSL
# replace 'platyps' with your module name
Install-Module -Scope CurrentUser -Name platyps
@arnos-stuff
arnos-stuff / alias-gist-create.sh
Last active December 7, 2022 22:13
shell command that automatically submits a gist to your github account after opening vscode to ask for you to paste/write the gist's content
# the rest of your ~/.bashrc or ~/.bash_profile (even ~/.zshrc)
# ...
# ...
# aliases
# first parameter: extension (ex: py, gz, txt, js, ...)
# second parameter: filename (w/o extension)
# third parameter: description of the gist
alias ghgist='_ghgist(){ mkdir -p /tmp/ghghist ; code -w "/tmp/ghghist/$2.$1" ; cat /tmp/ghghist/$2.$1 | gh gist create -d "$3" -p -f "$2.$1" | rm -rf /tmp/ghghist/$2.$1}; _ghgist'
@arnos-stuff
arnos-stuff / .zshrc
Last active December 23, 2022 20:51
my .zshrc as of 04/12/2022
# zi setup
source ~/.zi/bin/zi.zsh
# Use modern completion system
skip_global_compinit=1
zi compinit
# zi added metaplugins
# zi light z-shell/z-a-meta-plugins
# zi light-mode for @zsh-users @console-tools @fuzzy @z-shell @annexes+rec
zi light z-shell/z-a-bin-gem-node
https://regex101.com/r/3fc640/1
@arnos-stuff
arnos-stuff / lognormal_errors_solver.py
Created December 7, 2022 22:19
Inferring lognormal error distributions from odds ratios and bayes rule
from typing import List, Tuple
from numba import jit, float64
import sympy as sp
import numpy as np
import scipy.optimize as opt
def from_confidence_intervals(lower: float, upper: float, symbolic=False) -> (float, float):
"""Compute the mean and standard deviation of a lognormal distribution from the
confidence interval of the mean.
@arnos-stuff
arnos-stuff / customize-windows-term.ps1
Last active December 12, 2022 19:40
how to customize windows term without admin rights on your work laptop
# how to customize windows term without admin rights on your work laptop
## install windows terminal from MS Store (no admin rights)
## from: https://apps.microsoft.com/store/detail/windows-terminal/9N0DX20HK701
## install scoop
## from : https://scoop.sh/
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser # Optional: Needed to run a remote script the first time
irm get.scoop.sh | iex
@arnos-stuff
arnos-stuff / flatten.py
Created December 15, 2022 11:36
flatten a dict baseline (should remove class method)
def flatten(cls, obj):
if isinstance(obj, (str, int, float)):
return obj
elif isinstance(obj, list):
return [cls.flatten(item) for item in obj]
elif isinstance(obj, dict):
flatobj = {}
for key, val in obj.items():
if isinstance(val, list):
for i, item in enumerate(val):
@arnos-stuff
arnos-stuff / get-all-posh-themes.ps1
Created December 15, 2022 15:17
self hacked code if your themes are somehow lost within your filesystem
$response = (curl "https://github.com/JanDeDobbeleer/oh-my-posh/blob/eed32ec55a392928cab6cfb52b0311677febd089/themes")
$content = $response.Content
# "/JanDeDobbeleer/oh-my-posh/blob/eed32ec55a392928cab6cfb52b0311677febd089/themes/M365Princess.omp.json"
# JanDeDobbeleer/oh-my-posh/blob/main/themes/1_shell.omp.json
$results = $content | Select-String '([a-zA-Z0-9\._\-]+)\.omp\.json' -AllMatches
$array = $results.Matches.Value
@arnos-stuff
arnos-stuff / arno-one-line.omp.json
Created December 16, 2022 18:16
My current Oh-My-Posh one-line config file
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "right",
"segments": [
{
"foreground": "#3C873A",
"properties": {
"fetch_package_manager": true,