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
""" | |
Add this to pre-commit config | |
``` | |
- repo: local | |
hooks: | |
- id: helptext-compiler | |
name: helptext-compiler | |
description: "Generates help texts for the CLI" | |
language: system | |
entry: poetry run python path/to/this/file/helptext_compiler.py |
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
Agieren Sie als Assistent für deutsche Konversationsübungen. Ihre Aufgabe ist es, das Gespräch in Gang zu halten. | |
Antworten Sie immer mit maximal 3-5 Sätzen. Seien Sie locker und informell. | |
Wenn ein Nutzer etwas auf Englisch sagt, übersetze es ins Deutsche und zeige es als Korrektur an. | |
Wenn der Benutzer bei jeder Antwort einen Fehler macht, | |
zeigen Sie die Korrekturen in einem Abschnitt namens "Korrekturen" an, | |
bevor Sie in einem Abschnitt namens "Antwort" antworten. | |
Hier ist ein Beispiel für die Struktur, wenn es Korrekturen gibt. | |
""" | |
**Korrekturen** |
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
@value | |
struct State[T: AnyRegType]: | |
var _value: T | |
fn get(self) -> T: | |
return self._value | |
fn set(inout self, value: T): | |
self._value = value |
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
#!/bin/sh | |
if [ "$#" -ne 1 ]; then | |
echo "Usage: $0 [URL]" | |
exit 1 | |
fi | |
url="$1" | |
repo_name=$(basename "$url" .git) | |
org_name=$(echo "$url" | sed -E 's/^.*[/:]([^/]+)\/[^/]+$/\1/') |
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
.PHONY: dev | |
dev: | |
pip install -qU pip | |
poetry config virtualenvs.in-project true | |
poetry install --no-root | |
poetry run pre-commit install | |
poetry run pre-commit run -a | |
.PHONY: fmt | |
fmt: |
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
""" | |
initial prompt: | |
assuming github issues will have their first line in the body as "#dep: #1, #2, #4", | |
write a python script to get all open issues in a repo using the github rest API that | |
will parse this information and create a flowchart using mermaid.js to show the issue | |
dependenices. Also if there are no dependencies for an issue, add it to the flowchart | |
anyway. Remember to do a null check on the body before checking if a string exists | |
inside it. Use the requests library and not the github library | |
""" |
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 python:3.8-slim | |
WORKDIR /tmp | |
ENV SPARK_HOME=/opt/spark-3.1.2-bin-hadoop3.2 | |
# Spark, julia | |
RUN apt update \ | |
&& apt-get install -y \ | |
wget htop zsh git gnupg curl zip unzip vim cmake tmux sudo openjdk-11-jre \ | |
&& wget https://dlcdn.apache.org/spark/spark-3.1.2/spark-3.1.2-bin-hadoop3.2.tgz \ |
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
function divide_range_into_max_n_chunks(r::UnitRange{Int64}, n::Int64) | |
range_length = r.stop - r.start | |
chunk_size = Int64(ceil(range_length / n)) | |
return [i:min(i + chunk_size - 1, r.stop) for i in r.start:chunk_size:r.stop] | |
end | |
macro parallel_broadcast(col_a, broadcasted_operator, col_b) | |
return (:macrocall, Symbol("@threads"), :(#= none:1 =#), (:for, (:(=), :subrange, (:call, :divide_range_into_n_chunks, (:call, :(:), 1, :df_length), (:call, :nthreads))), (:block, | |
:(#= none:2 =#), | |
(:(=), (:ref, :result_col, :subrange), (:call, broadcasted_operator, (:call, :view, col_a, :subrange), (:call, :view, col_b, :subrange))) |
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
# Install requirements | |
sudo apt-get install -y build-essential checkinstall libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev zlib1g-dev openssl libffi-dev python3-dev python3-setuptools wget sudo apt-get install liblzma-dev libssl-dev libncurses5-dev libsqlite3-dev libreadline-dev libtk8.5 libgdm-dev libdb4o-cil-dev libpcap-dev | |
# Prepare to build | |
mkdir /tmp/Python37 | |
cd /tmp/Python37 | |
# Install |
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
# Compute ndcg @ k | |
def ndcg_at_k(predictions_df, k): | |
""" | |
This pandas dataframe should contain the columns "customer_id", | |
"estimate", and "label". | |
Where `estimate` is a recommendation score | |
that we can sort by descending order. | |