Skip to content

Instantly share code, notes, and snippets.

View xkortex's full-sized avatar
📡

Mike McDermott xkortex

📡
View GitHub Profile
@xkortex
xkortex / basic_aio_subprocessor.py
Last active March 6, 2021 01:20
A server which runs subprocesses in response to HTTP requests and dumps stdout/stderr to terminal
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""WORK IN PROGRESS!! USE AT YOUR OWN RISK!!"""
import os
import sys
from typing import Dict, List, Optional
from urllib.parse import urlparse, ParseResult
@xkortex
xkortex / get_boot_repair.sh
Created February 15, 2021 01:56
curl and get boot-repair
#!/bin/bash
# bash -c "$(curl -LSfs https://raw.githubusercontent.com/this-file.sh)"
sudo apt update
sudo apt install -y curl
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt update
sudo apt install -y boot-repair
@xkortex
xkortex / godbolt_log.h
Last active January 23, 2021 18:18
Header lib for simplified godbolt logging
/*
* File: Log.h
* Based on https://stackoverflow.com/a/17605306/ by manu343726
* https://github.com/Manu343726/Cpp11CustomLogClass
* Author: xkortex
* Stackoverflow code snipets are licensed under cc-wiki
*/
#ifndef LOG_H
#define LOG_H
@xkortex
xkortex / optoparser.py
Last active August 27, 2021 22:32
hacking on options parser mixin
#!/usr/bin/env python3
"""
I've been want for something that lets me reuse flags across multiple subcommand, between projects, etc.
The native argparse makes this a little tricky, especially if you want custom pydantic data classes.
I have also wanted a click-like ease of experience but without all the decorators and deep stack traces clouding my logs.
I spent a bit of time hacking on the idea and came up with some interesting patterns. There's still a lot to iron out,
a lot of the ergonomics could be improved with more introspection, but I thought I would at least throw this over the wall
and see if there's any interest in it.
@xkortex
xkortex / Dockerfile
Last active September 15, 2020 20:49
improved conda SHELL for docker RUN
## Conda with custom entrypoint from base ubuntu image
## Build with e.g. `docker build -t monoconda .`
## Run with `docker run --rm -it monoconda bash` to drop right into
## the environment `foo` !
FROM ubuntu:18.04
## Install things we need to install more things
RUN apt-get update -qq &&\
apt-get install -qq curl wget git &&\
apt-get install -qq --no-install-recommends \
@xkortex
xkortex / Dockerfile
Last active September 15, 2020 20:57
Override Docker RUN shell directive such that each stanza is invoked in a Conda env
## Conda with custom entrypoint from base ubuntu image
## Build with e.g. `docker build -t monoconda .`
## Run with `docker run --rm -it monoconda bash` to drop right into
## the environment `foo` !
FROM ubuntu:18.04
## Install things we need to install more things
RUN apt-get update -qq &&\
apt-get install -qq curl wget git &&\
apt-get install -qq --no-install-recommends \
@xkortex
xkortex / entry.sh
Last active February 17, 2023 02:02
dockerfile entrypoint for activating conda environment
#!/bin/bash
## Entrypoint for docker RUN directives as well as ENTRYPOINT with conda env
## Enable by adding:
## COPY entry.sh ./
## SHELL ["/entry.sh", "/bin/bash", "-c"]
##
## Optionally, set the following env to select a conda env to run in
## ENV CONDA_DEFAULT_ENV=foo
## You may also want to add something like
## RUN conda init bash && echo 'conda activate "${CONDA_TARGET_ENV:-base}"' >> ~/.bashrc
import (
"fmt"
"golang.org/x/net/context"
"net"
"time"
)
type AddrResponse struct {
addrs []string
err error
@xkortex
xkortex / cuda_install_29527.log
Last active September 27, 2019 17:01
cuda runfile install error
Do you accept the previously read EULA?
accept/decline/quit: accept
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48?
(y)es/(n)o/(q)uit: y
Do you want to install the OpenGL libraries?
(y)es/(n)o/(q)uit [ default is yes ]: n
Do you want to run nvidia-xconfig?