Skip to content

Instantly share code, notes, and snippets.

View chyld's full-sized avatar
:electron:
import numpy

Chyld Medford chyld

:electron:
import numpy
View GitHub Profile
# Add Docker's official GPG key:
apt-get update
apt-get install ca-certificates curl gnupg
install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
chmod a+r /etc/apt/keyrings/docker.gpg
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian \
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin

You can inherit the environment variables from PID 1 by iterating over the list of null-terminated strings in /proc/1/environ, parsing the first characters up to the first = as the variable name, setting the remaining value as that variable, and exporting it.

The Code Snippet

This works with multiline environment variables, and environment variables with arbitrary values, like strings, including = or JSON blobs.

Paste this in your current terminal session to inherit the environment variables from PID 1:

FROM archlinux:latest
ENV TZ America/Los_Angeles
RUN pacman -Sy --noconfirm
RUN pacman -S --noconfirm shellcheck starship cowsay wget git unzip neovim vim ripgrep fd bat hexyl htop tree inetutils exa inotify-tools lua xclip fzf glow duf bpytop lazygit openssh
RUN pacman -S --noconfirm --needed base-devel
RUN useradd -ms /bin/bash chyld
USER chyld
{
"editor.fontFamily": "FiraCode Nerd Font",
"editor.fontSize": 14,
"editor.fontLigatures": true,
"editor.renderLineHighlight": "none",
"editor.minimap.enabled": false,
"editor.renderWhitespace": "all",
"editor.formatOnPaste": true,
"editor.insertSpaces": true,
"editor.stickyScroll.enabled": true,
{
"workbench.startupEditor": "none",
"window.menuBarVisibility": "toggle",
"files.trimTrailingWhitespace": true,
"breadcrumbs.enabled": true,
"dev.containers.dockerPath": "podman",
"editor.minimap.enabled": false,
"editor.fontFamily": "FiraCode NF",
parameters = {'criterion': ['entropy', 'gini'],
'max_depth': range(1, 20),
'min_samples_split': range(2, 10),
'max_features': ['sqrt', 'log2', None]
}
model = DecisionTreeClassifier()
gs = GridSearchCV(model, parameters, cv=5, n_jobs=-1, verbose=1)
gs.fit(X_train, y_train)
gs.best_score_, gs.best_params_
import numpy as np
from sklearn.metrics import confusion_matrix
def roc_curve(probabilities, labels):
'''
INPUT: numpy array, numpy array
OUTPUT: list, list, list
Take a numpy array of the predicted probabilities and a numpy array of the
true labels.
@chyld
chyld / settings.json
Created November 28, 2021 06:04
windows terminal settings.json
// This file was initially generated by Windows Terminal 1.11.2921.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
dotnet new tool-manifest
dotnet tool install dotnet-ef
dotnet ef
dotnet add App/App.csproj package Microsoft.EntityFrameworkCore.Design
dotnet add App/App.csproj package Microsoft.EntityFrameworkCore.Tools
dotnet add App/App.csproj package Microsoft.EntityFrameworkCore.SQLite
dotnet ef migrations add "initial"