This gist provides the learning-python3.ipynb notebook file, which can be viewed and edited in a Jupyter Notebook server to learn Python 3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"errors" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
"runtime" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
def add_gaussian_noise(X_imgs): | |
gaussian_noise_imgs = [] | |
row, col, _ = X_imgs[0].shape | |
# Gaussian distribution parameters | |
mean = 0 | |
var = 0.1 | |
sigma = var ** 0.5 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** getSpread returns the difference between the highest bid and the lowest | |
* offer (ask). It throws an exception, if the orders do not contain both bids | |
* and asks. */ | |
double OrderBook::getSpread(std::vector<OrderBookEntry>& orders) | |
{ | |
if (orders.empty()) { | |
return 0; | |
} | |
// https://web.stanford.edu/class/cme241/lecture_slides/Tour-OrderBook.pdf#page=3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SGR color constants | |
# rene-d 2018 | |
class Colors: | |
""" ANSI color codes """ | |
BLACK = "\033[0;30m" | |
RED = "\033[0;31m" | |
GREEN = "\033[0;32m" | |
BROWN = "\033[0;33m" | |
BLUE = "\033[0;34m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Reference: kstathou/acl-search-engine | |
# !pip install faiss-cpu --no-cache | |
# !pip install sentence_transformers | |
import faiss | |
import numpy as np | |
import pandas as pd | |
import pickle | |
import torch |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
llmc() { | |
local system_prompt='Output a command that I can run in a ZSH terminal on macOS to accomplish the following task. Try to make the command self-documenting, using the long version of flags where possible. Output the command first enclosed in a "```zsh" codeblock followed by a concise explanation of how it accomplishes it.' | |
local temp_file=$(mktemp) | |
local capturing=true | |
local command_buffer="" | |
local first_line=true | |
local cleaned_up=false # Flag to indicate whether cleanup has been run | |
cleanup() { | |
# Only run cleanup if it hasn't been done yet |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM docker.io/python:3.9-bullseye AS build | |
WORKDIR "/app" | |
# Install dependecies | |
# hadolint ignore=DL3008,DL3013 | |
RUN set -eux && \ | |
apt-get update; \ | |
apt-get install --no-install-recommends -y \ | |
python3-dev build-essential patchelf upx; \ | |
apt-get clean; \ |
NewerOlder