This file contains hidden or 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
| """ | |
| The most atomic way to train and inference a GPT in pure, dependency-free Python. | |
| This file is the complete algorithm. | |
| Everything else is just efficiency. | |
| @karpathy | |
| """ | |
| import os # os.path.exists | |
| import math # math.log, math.exp |
This file contains hidden or 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 dis | |
| from typing import assert_type | |
| from zoneinfo import available_timezones | |
| import pandas as pd | |
| from collections import deque | |
| def prepare_trade_republic_transactions(file_path): | |
| """ | |
| Prepares and filters transaction data from a custom Trade Republic CSV file via pyTR package. |
This file contains hidden or 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
| #!/usr/bin/env python | |
| """strip outputs from an IPython Notebook | |
| Opens a notebook, strips its output, and writes the outputless version to the original file. | |
| Useful mainly as a git filter or pre-commit hook for users who don't want to track output in VCS. | |
| This does mostly the same thing as the `Clear All Output` command in the notebook UI. | |
| LICENSE: Public Domain |
This file contains hidden or 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 logging | |
| from colorama import init, Fore, Back | |
| init(autoreset=True) | |
| class ColorFormatter(logging.Formatter): | |
| # Change this dictionary to suit your coloring needs! | |
| COLORS = { | |
| "WARNING": Fore.RED, |
This file contains hidden or 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/bash | |
| # | |
| # Helper utility to simplify using Bash's getopts utility, and make it usable with functions. | |
| # | |
| # Example usage: | |
| # foo() { | |
| # local _usage=... # optional usage string | |
| # eval "$(parse_opts 'ab:f:v')" # provide a standard getopts optstring | |
| # echo "f is $f" # opts are now local variables | |
| # if (( a )); then # check boolean flags with (( ... )) |
This file contains hidden or 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
| """ | |
| A script to automatically export bookmarks from Firefox's SQLite database. | |
| There does not seem to be a programmatic way to get Firefox to export its bookmarks in | |
| the conventional HTML format. However, you can access the bookmark information directly | |
| in Firefox's internal database, which is what this script does. | |
| Always be careful when working with the internal database! If you delete data, you will | |
| likely not be able to recover it. |
This file contains hidden or 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
| # Adding this script to PS profile allows quick actions for Python venv library. | |
| # Create a variable where virtual environments are located | |
| $VENV_HOME="$HOME\.virtualenvs\" | |
| # A function to list all available virtual environments | |
| function Get-Venvs{ | |
| Get-ChildItem -Path $VENV_HOME -Name | |
| } |
This file contains hidden or 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
| # include following in .bashrc / .bash_profile / .zshrc | |
| # usage | |
| # $ mkvenv myvirtualenv # creates venv under ~/.venv/ | |
| # $ venv myvirtualenv # activates venv | |
| # $ deactivate # deactivates venv | |
| # $ rmvenv myvirtualenv # removes venv | |
| export VENV_HOME="$HOME/.venv" | |
| [[ -d $VENV_HOME ]] || mkdir $VENV_HOME |
This file contains hidden or 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
| ;; How to make org-mode org-insert-link (C-c C-l) automatically fill in the description from a webpage: | |
| (defun jmn/url-get-title (url &optional descr) | |
| "Takes a URL and returns the value of the <title> HTML tag, | |
| Thanks to https://frozenlock.org/tag/url-retrieve/ for documenting url-retrieve" | |
| (let ((buffer (url-retrieve-synchronously url)) | |
| (title nil)) | |
| (save-excursion | |
| (set-buffer buffer) | |
| (goto-char (point-min)) |
This file contains hidden or 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
| [MASTER] | |
| # Specify a configuration file. | |
| #rcfile= | |
| # Python code to execute, usually for sys.path manipulation such as | |
| # pygtk.require(). | |
| #init-hook= | |
| # Profiled execution. |
NewerOlder