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
| """ | |
| Demonstrate how Python modifies values by reference, so if you pass an objec to | |
| a function and modify it, it's modified even outside of the scope of that function, | |
| so there is no need to return the modified object. | |
| When you run this you should see something like: | |
| 139706416086160 Default description | |
| 139706416086160 Nothing very interesting. Le sigh. | |
| """ |
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
| """Make a copy of all of my .env files in all of my projects""" | |
| import os | |
| import glob | |
| import shutil | |
| PROJECTS_DIR=os.path.expanduser("~/Projects/") | |
| DEST_DIR = "dot_files" | |
| try: |
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
| ## Overview | |
| │ Analyzed Image │ Comparison Image | |
| ────────────────────┼────────────────────────────────────┼────────────────────────────── | |
| Target │ python:3.12 │ python:3.12-alpine | |
| digest │ 5a2936b50ea6 │ dc2e8896e2bc | |
| platform │ linux/amd64 │ linux/amd64 | |
| vulnerabilities │ 1C 1H 8M 93L 5? │ 0C 2H 1M 0L |
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
| # Dockerfile that patches 3.12-alpine | |
| # as of Nov. 15, 2023771 | |
| # `docker scout cves` reports no vulnerabilities | |
| FROM python:3.12-alpine | |
| # Fixes CVE for pip | |
| # https://scout.docker.com/v/CVE-2023-5752 | |
| RUN pip install --upgrade pip |
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 json | |
| import boto3 | |
| from hashlib import md5 | |
| from datetime import datetime | |
| // simple lambda to act as an activitypub inbox so you can receive | |
| // follow requests, comments, etc from other servers. | |
| // 1. set this up in a lambda and point API gateway at it. | |
| // 2. set the api URL as your inbox in your actor JSON response |
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
| """ | |
| Deliver an ActivityPub message to an inbox | |
| This is largely based on a ruby example `deliver.rb` from this blog post: | |
| https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/ | |
| """ | |
| from datetime import datetime |
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
| # Generate a bunch of commands to delete all versions of | |
| # lambdas with a given LAMBA_PREFIX | |
| # | |
| # this script generates `delete-commands.sh` which you can | |
| # inspect first before running. this is super dangerous so | |
| # you probably should not use this script. | |
| LAMBDA_PREFIX=example-lambda-group-name | |
| for FUNCTION in $(aws lambda list-functions --region=us-east-1 \ |
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
| conda create --name textgenrnn python | |
| conda activate textgenrnn | |
| conda install cudatoolkit==10.2.89 | |
| # this special conda source is vital to get the correct 8.1.x version of cudnn: | |
| conda install -c conda-forge cudnn | |
| git clone https://github.com/minimaxir/textgenrnn.git | |
| cd textgenrnn | |
| pip install -r requirements.txt |
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
| matches | |
| ngrams | |
| *.swp | |
| *.pem | |
| *.json | |
| venv | |
| *.pyc |
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 cheap and cheerful logger that wraps console.log, .warn, .error, with | |
| * labeling and silencing to make debugging with devtools easier. | |
| */ | |
| export default class DebugLogger { | |
| private _label: string; | |
| private _silent: boolean; | |
| constructor(label: string) { | |
| this._label = label; |
NewerOlder