Skip to content

Instantly share code, notes, and snippets.

View Erotemic's full-sized avatar
An eroteme is a question mark

Jon Crall Erotemic

An eroteme is a question mark
View GitHub Profile
@Erotemic
Erotemic / proxy-debug-v3.sh
Created May 7, 2024 21:58
proxy-debug-v3.sh
# The following documents steps I took when following instructions from:
# https://askubuntu.com/a/1512388/426149
#===========================================#
# PART 1 - Test Manual SOCKS5 Configuration #
#===========================================#
# Note that all following steps, are done on the local client, the remote
# just needs to be accessible vis SSH.
@Erotemic
Erotemic / pac-file-reproduce.sh
Created May 7, 2024 01:34
pac-file-reproduce.sh
exact_steps_taken(){
DOMAIN=mlb.com
echo "DOMAIN = $DOMAIN"
nslookup "$DOMAIN"
DOMAIN_ADDRESS=34.102.169.19
echo "DOMAIN_ADDRESS = $DOMAIN_ADDRESS"
echo '
@Erotemic
Erotemic / pac-file-notes.sh
Created May 6, 2024 04:11
Attempt to log in a PAC file (not working)
# https://stackoverflow.com/questions/66514500/how-do-i-configure-a-python-server-for-post
# Run a test server on port 8000
python -c 'if 1:
from http.server import BaseHTTPRequestHandler, HTTPServer
class handler(BaseHTTPRequestHandler):
def do_GET(self):
self.send_response(200)
self.send_header("Content-type", "text/html")
self.end_headers()
@Erotemic
Erotemic / cpkt_error_mwe.py
Created March 10, 2023 02:42
cpkt_error_mwe.py
import torch
import torch.nn
from torch import nn
from torch.utils.data import Dataset
import numpy as np
import pytorch_lightning as pl
from pytorch_lightning.cli import LightningCLI
from typing import List, Dict
@Erotemic
Erotemic / jsonargparse_scriptconfig_poc.py
Last active February 19, 2023 02:09
jsonargparse_scriptconfig_poc.py
import jsonargparse
import inspect
from jsonargparse.parameter_resolvers import ParamData
from jsonargparse.signatures import get_signature_parameters
from jsonargparse.signatures import get_doc_short_description
from typing import List, Set, Union, Optional, Tuple, Type, Any
from jsonargparse.util import get_import_path, iter_to_set_str
from argparse import SUPPRESS
from jsonargparse.typing import is_final_class
@Erotemic
Erotemic / transfer_assets.py
Created November 28, 2022 16:34
transfer_assets - POC non-copyrighted SM64 generated randomized assets.
"""
make VERSION=us -j16
build/us_pc/sm64.us
SeeAlso:
https://github.com/TechieAndroid/sm64redrawn
"""
import ubelt as ub
import aifc
import kwimage
@Erotemic
Erotemic / pyenv.Dockerfile
Created October 31, 2022 15:28
pyenv.Dockerfile
# syntax=docker/dockerfile:1.3.0-labs
# This dockerfile uses new-ish buildkit syntax.
# Details on how to run are on the bottom of the file.
# (docker devs: todo unconsequential heredocs)
FROM nvidia/cuda:11.4.3-cudnn8-devel-ubuntu20.04
ARG PYTHON_VERSION=3.10.5
ARG PYENV_VERSION=v2.3.3
@Erotemic
Erotemic / install_python_pyenv.rst
Created October 31, 2022 15:26
install_python_pyenv.rst

An fully FOSS alternative to a conda environment is pyenv. The only real drawback to pyenv is that you must be able to compile Python itself.

On ubuntu this can be setup as follows:

### Based on code in https://github.com/Erotemic/local/blob/main/tools/pyenv_ext/pyenv_ext_commands.sh
@Erotemic
Erotemic / ijson_ext.py
Created October 28, 2022 15:10
ijson_ext.py
"""
Add NaN parsing to normal ijson pure-python parsing backend.
Example:
>>> import ijson_ext as ijson
>>> text = ub.codeblock(
>>> '''
>>> {"id": 246, "image_id": 123, "flag": true, "empty": null, "category_id": 2, "bbox": [ NaN, 5, 130, 290 ] }
>>> ''')
>>> import io
@Erotemic
Erotemic / gitlab-ci-example.yml
Last active September 16, 2022 19:15
gitlab-ci-example.yml
# Abuse YAML notation to make a heredoc. This will be ignored by the CI.
stages:
- build
- test
- gpgsign
- deploy
### TEMPLATES ###