Skip to content

Instantly share code, notes, and snippets.

Joongi Kim achimnol

Block or report user

Report or block achimnol

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
achimnol /
Last active Oct 31, 2019 — forked from j-min/
TensorFlow single GPU example
from __future__ import print_function
Basic Multi GPU computation example using TensorFlow library.
Author: Aymeric Damien
This tutorial requires your machine to have 1 GPU
"/cpu:0": The CPU of your machine.
achimnol /
Last active Jun 2, 2019 — forked from suhlig/install-tmux
Install tmux on rhel/centos 7
# Install tmux on rhel/centos 7
# install deps
yum install gcc kernel-devel make ncurses-devel
PREFIX="${HOME}/.local/bin" # user-only install (change to /usr/local for global install)
SUDO="" # change to "sudo" to install on /usr/local
achimnol /
Last active May 30, 2019
Idea for contextvars-based API design for ring-cache
import redis
from ring import Ring
import contextvars
redis_connection = contextvars.ContextVar('redis_connection', None)
ring = Ring(...)
class A:
@ring.redis(redis_connection, ...)
def get_something(self):
achimnol /
Last active Feb 6, 2019
GraphQL generic list using interfaces
import graphene
import json
import sys
class Item(graphene.Interface):
id = graphene.String(required=True)
class PaginatedList(graphene.Interface):
achimnol /
Created Jan 22, 2019
Reading Docker image labels from registry
TOKEN=$(curl -s "$IMAGE:pull&" | jq -r .token)
CONFIG_DIGEST=$(curl -s -H"Accept: application/vnd.docker.distribution.manifest.v2+json" -H"Authorization: Bearer $TOKEN" "$IMAGE/manifests/$TAG" | jq -r .config.digest)
RESULT=$(curl -sL -H"Authorization: Bearer $TOKEN" "$IMAGE/blobs/$CONFIG_DIGEST" | jq -r .container_config.Labels)
echo $RESULT
achimnol /
Created Jan 20, 2019
Running alternative Docker daemon on the same host
#! /bin/bash
# References:
# -
# -
# First you need to have Docker 18.09+ and the bridge-utils package installed.
: ${bridge=altdocker0}
: ${base=$ROOT/$bridge}
achimnol /
Last active Jan 10, 2018
async generator closing
import asyncio
import pytest
async def test_close_asyncgen():
loop = asyncio.get_event_loop()
async def mygen():
print('mygen: 0-begin')
achimnol /
Created Oct 28, 2017
async getitem with futures
import asyncio
class MyAsyncDict:
async def async_getitem(self, fut, key):
await asyncio.sleep(0.5)
raise RuntimeError('oops')
except Exception as e:
achimnol /
Last active Sep 14, 2017
GraphQL Sample in Python
import asyncio
import base64
import enum
import secrets
from pprint import pprint
import graphene
from graphql.execution.executors.asyncio import AsyncioExecutor
import ctypes
import ctypes.util
_libcuda = ctypes.CDLL(ctypes.util.find_library('cudart'))
if __name__ == '__main__':
# You should put the path to the CUDA toolkit library into LD_LIBRARY_PATH envvar
# or into the system-wide configuration at /etc/
count = ctypes.c_int(0)
You can’t perform that action at this time.