Skip to content

Instantly share code, notes, and snippets.

View pzelnip's full-sized avatar
🤷‍♂️

Adam Parkin pzelnip

🤷‍♂️
View GitHub Profile
@pzelnip
pzelnip / test.py
Created March 2, 2023 17:31
Test code snippet
@classmethod
def get_sort_key(cls, **kwargs):
_id = kwargs.get("sort_id")
return f"{cls.classname()}:{_id}"
@pzelnip
pzelnip / tasks.json
Created January 29, 2023 19:29
Example of using variables to minimize duplication of path to Python Virtual Env in VS Code tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"options": {
"env": {
// Path to VENV from home directory
"PYTHON_VENV": "/.envs/myvirtualenv/bin/activate"
}
},
@pzelnip
pzelnip / gist:ca99bf955fe15f66225a41f597501dff
Created July 20, 2021 22:34
Brew output on updating pyenv to 2.0.3
==> Upgrading 1 outdated package:
pyenv 1.2.24.1 -> 2.0.3
==> Upgrading pyenv
1.2.24.1 -> 2.0.3
==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/manifests/2.0.3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pyenv/blobs/sha256:6fa7b23b73c8cdfcd4c18251f616f3ab9b10ef3526086996528340a78a8a0911
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:6fa7b23b73c8cdfcd4c18251f616f3ab9b10ef3526086996528340a78a8a0911?se=2021-07-20T02%3A10%3A00Z&sig=BPtR2NZ790Ag1OmJ52WTzAvzkWT%2FCtrFh%2BYSOj72wP8%3D&sp=r&spr=https&sr=b
######################################################################## 100.0%
@pzelnip
pzelnip / gist:641a862c19f35571c20fb7d2cb1aabe8
Last active July 20, 2021 22:39
Output of PYENV_DEBUG=1 pyenv init -
λ PYENV_DEBUG=1 pyenv init -
+(/usr/local/bin/pyenv:23): enable -f /usr/local/bin/../libexec/pyenv-realpath.dylib realpath
+(/usr/local/bin/pyenv:30): '[' -z '' ']'
++(/usr/local/bin/pyenv:32): type -P greadlink readlink
++(/usr/local/bin/pyenv:32): head -1
+(/usr/local/bin/pyenv:32): READLINK=/usr/bin/readlink
+(/usr/local/bin/pyenv:33): '[' -n /usr/bin/readlink ']'
+(/usr/local/bin/pyenv:58): '[' -z '' ']'
+(/usr/local/bin/pyenv:59): PYENV_ROOT=/Users/adam.parkin/.pyenv
+(/usr/local/bin/pyenv:63): export PYENV_ROOT
function joke { curl -s -H "Accept: application/json" https://icanhazdadjoke.com/ | jq ".joke"; }
PS1="\$(joke) $ "
@pzelnip
pzelnip / test.py
Last active March 6, 2019 10:50
Trying to figure out run_forever & asyncio
#Discussion from https://stackoverflow.com/a/29314606/808804
import asyncio
from threading import Thread
from concurrent.futures import Future
import functools
async def simple_coro():
await asyncio.sleep(3)
@pzelnip
pzelnip / docker_image_delete.sh
Last active June 9, 2018 01:49
Docker interactive image deletion
#!/bin/bash
select x in `docker images --format '{{.ID}}--{{.Repository}}/{{.Tag}}'` ; do docker rmi "${x%--*}"; done
@pzelnip
pzelnip / Dockerfile
Last active May 20, 2018 17:03
Travis Gem in Docker Container
FROM ubuntu:latest
RUN apt-get update
RUN apt-get install -y ruby ruby-dev make gcc
RUN gem install travis
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script language="javascript">
function foo() {
@pzelnip
pzelnip / Vagrantfile
Last active December 4, 2021 13:46
Ubuntu xenial64 (Ubuntu 16) Vagrantfile with Docker, pip, and awscli installed
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at