Skip to content

Instantly share code, notes, and snippets.

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

Adam Parkin pzelnip

🤷‍♂️
View GitHub Profile
@pzelnip
pzelnip / counting.py
Created August 25, 2016 00:36
Counting letters in a string
# From https://www.linkedin.com/groups/25827/25827-6166706414627627011
# "Today i did a simple test that you give a string to a function, and then the
# return output should count the letters sequencially; as following example:
# in: "aaaaabbbbccccccaaaaaaa" => out: "5a4b6c7a"
#
def func(input_string):
if not input_string:
return ""
if len(input_string) == 1:

Keybase proof

I hereby claim:

  • I am pzelnip on github.
  • I am pzelnip (https://keybase.io/pzelnip) on keybase.
  • I have a public key ASDYIRO6gz6gvvLqd86UzD6JUybqgU9miTPjHfV0ZuzJIAo

To claim this, I am signing this object:

@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
<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 / 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
@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 / 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)
function joke { curl -s -H "Accept: application/json" https://icanhazdadjoke.com/ | jq ".joke"; }
PS1="\$(joke) $ "
@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
@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%