Skip to content

Instantly share code, notes, and snippets.

View chrisliatas's full-sized avatar

Chris Liatas chrisliatas

View GitHub Profile
@chrisliatas
chrisliatas / devcontainer.json
Created March 23, 2024 19:59
devcontainer.json for a development environment. Combined with Dockerfile from comments.
{
"name": "Development Container",
"build": {
"dockerfile": "Dockerfile",
"context": "..",
"args": {
"VARIANT": "3.11",
"VARIANT_SFX": "-slim-bookworm",
"QUARTO_REL": "1.5.25",
"FONTS_VERSION": "3.1.1"
@chrisliatas
chrisliatas / Dockerfile
Last active March 23, 2024 20:02
Multi stage Dockerfile to create a development environment. Can be combined with vs code `devcontainers`.
# Variables
ARG VARIANT="3"
ARG VARIANT_SFX="-slim"
ARG FONTS_VERSION="3.1.1"
# Builder
FROM python:${VARIANT} as builder
ENV PYTHONFAULTHANDLER=1 \
PYTHONHASHSEED=random \
PYTHONUNBUFFERED=1 \

Tested only on Ubuntu 20.04, KDE Neon User Edition (based on Ubuntu 20.04) and OSX Mojave.

will probably work on other newer versions, with no changes, or with few changes in non-python dependencies (apt-get packages)

NOTE: Don't create a .sh file and run it all at once. It will not work. Copy, paste, and execute each command below manually. :-)

Ubuntu

# DO NOT RUN THIS AS A ROOT USER
@chrisliatas
chrisliatas / lightgbm_clf_params.py
Last active November 19, 2021 13:56
LightGBM parameters for classification problem.
# Production parameters
lgbm_params = {
'boosting_type': 'goss', # Gradient-based One-Side Sampling (goss)
'learning_rate': 0.05, # Boosting learning rate, default = 0.1
'n_estimators': 10000, # Number of boosted trees to fit, default = 100
'objective': 'binary', # the learning task and the corresponding learning objective, default = None
'class_weight': 'balanced', # Weights associated with classes, The ‘balanced’ mode*
'reg_alpha': 0.1, # L1 regularization term on weights (L1 penalty), default = 0.0
'reg_lambda': 0.1, # L2 regularization term on weights (L2 penalty), default = 0.0
'random_state': 67,
@chrisliatas
chrisliatas / random_impute_nan.py
Last active November 18, 2021 15:18
Impute missing values with random selection
import numpy as np
def imput_nan_rand(col, in_place=False):
"""Get a pd.Series with NaNs and impute missing values with random selection
from the column's values range.
"""
# Initialize random generator
rng = np.random.default_rng()
c = col if in_place else col.copy()
@chrisliatas
chrisliatas / upgrade-postgres-9.5-to-9.6.md
Created December 13, 2018 10:52 — forked from delameko/upgrade-postgres-9.5-to-9.6.md
Upgrading PostgreSQL from 9.5 to 9.6 on Ubuntu 16.04

TL;DR

Install Postgres 9.6, and then:

sudo pg_dropcluster 9.6 main --stop
sudo pg_upgradecluster 9.5 main
sudo pg_dropcluster 9.5 main
@chrisliatas
chrisliatas / keybase.md
Created December 7, 2018 16:50
keybase proof for my GitHub username

Keybase proof

I hereby claim:

  • I am chrisliatas on github.
  • I am cliatas (https://keybase.io/cliatas) on keybase.
  • I have a public key ASBqY_G0Ljr-oVpVXZHC-L-rrWo8HZcvD20grn4VEvS6-go

To claim this, I am signing this object: