Skip to content

Instantly share code, notes, and snippets.

@suiluj
suiluj / .vimrc
Last active November 28, 2022 08:44
[.vimrc My vim configuration file] with link to interesting YouTube video #vim
" GREAT CONFIGURATION VIDEO: https://youtu.be/XA2WjJbmmoM
" BASIC SETUP:
" enter the current millenium
set nocompatible
" enable syntax and plugins (for netrw)
syntax enable
filetype plugin on
@suiluj
suiluj / epoch_seconds_to_time_string_with_timezone.py
Last active July 21, 2019 18:00
Convert UNIX time (seconds since epoch) to a date time string with timezone information
# nice blog post: https://www.artificialworlds.net/blog/2017/06/09/python-printing-utc-dates-in-iso8601-format-with-time-zone/
import time
from datetime import datetime, timezone
timeNow = time.time()
print("local time without timezone ",datetime.fromtimestamp(timeNow).isoformat())
print("local time with timezone ",datetime.fromtimestamp(timeNow).astimezone().isoformat())
print("UTC time with timezone ",datetime.fromtimestamp(timeNow, tz=timezone.utc).isoformat())
@suiluj
suiluj / jupyterlab_user_preferences.json
Last active December 29, 2023 14:33
[JupyterLab Shortcuts] Restart Kernel and run all cells - Run selected cell and below #jupyterlab #jupyter
{
"shortcuts": [
{
"command": "runmenu:restart-and-run-all",
"keys": [
"Shift Backspace"
],
"selector": "[data-jp-code-runner]"
},
{
@suiluj
suiluj / python_logging.py
Last active June 7, 2024 09:24
python logging pretty print pformat indent width line break
import logging
import time
from pprint import pformat
# pretty print logs: https://stackoverflow.com/a/11093247/5628238
# pformat indent: https://stackoverflow.com/a/29469358/5628238
# (even needed when using %s string format): do not evaluate complex pformat when log level not printed: https://docs.python.org/3/library/logging.html#logging.Logger.isEnabledFor
# (wrong: complex variable string takes time nevertheless): https://reinout.vanrees.org/weblog/2015/06/05/logging-formatting.html
# https://stackoverflow.com/questions/13131400/logging-variable-data-with-new-format-string
# main script or module
@suiluj
suiluj / info.md
Last active May 22, 2021 18:26
quasar env file dev and production environment (production with environment variables not from file) dotenv

install dotenv package:

npm install --save dotenv

file: quasar.conf.js

build: {
@suiluj
suiluj / README.md
Last active February 14, 2023 15:17
WSL2 Install and configure

WSL2 Install and configure

Install distro

  • check wsl box in windows features settings
  • powershell: wsl --set-default-version 2
  • download ubuntu here: https://docs.microsoft.com/de-de/windows/wsl/install-manual
  • powershell: Add-AppxPackage .\app_name.appx (choose ubuntu.appx file)
  • powershell: wsl -l -v => wsl --setdefault <DistributionName>
  • if docker does not work just exit terminal and reenter ubuntu with "wsl"
@suiluj
suiluj / README.md
Last active December 13, 2022 11:58
nbstriput jupyter notebooks do not commit output logs improved: install globally (to not forget for new repos)
@suiluj
suiluj / README.md
Created April 5, 2022 09:18
Bind mount folder in docker compose without having to change folder or file permissions

Bind mount folder in docker compose without having to change folder or file permissions

  • check user and group of host user: https://kb.iu.edu/d/adwf

    id -u <username>
    id -g <username>
    # (most times both 1000)
    # show all just used id command

id

@suiluj
suiluj / .devcontainer---devcontainer.json
Last active December 3, 2022 00:07
Golang Start Template #golang #start-template
// example .devcontainer/devcontainer.json
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.231.6/containers/go
{
"name": "Go",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update the VARIANT arg to pick a version of Go: 1, 1.18, 1.17
// Append -bullseye or -buster to pin to an OS version.
@suiluj
suiluj / .pylintrc
Last active July 16, 2022 20:57
pylint ignore disable
[MASTER]
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code.
extension-pkg-allow-list=
# A comma-separated list of package or module names from where C extensions may
# be loaded. Extensions are loading into the active Python interpreter and may
# run arbitrary code. (This is an alternative name to extension-pkg-allow-list