This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# References: | |
# - https://stackoverflow.com/questions/32334167/is-it-possible-to-start-multiple-docker-daemons-on-the-same-machine | |
# - https://docs.docker.com/engine/reference/commandline/dockerd/ | |
# First you need to have Docker 18.09+ and the bridge-utils package installed. | |
ROOT=/opt/altdocker | |
: ${bridge=altdocker0} | |
: ${base=$ROOT/$bridge} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import pytest | |
@pytest.mark.asyncio | |
async def test_close_asyncgen(): | |
loop = asyncio.get_event_loop() | |
async def mygen(): | |
print('mygen: 0-begin') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import base64 | |
import enum | |
import secrets | |
from pprint import pprint | |
import graphene | |
from graphql.execution.executors.asyncio import AsyncioExecutor | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ld.so.conf.d/. | |
count = ctypes.c_int(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "CUDA initialization without X environments" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
pre-start script | |
DRIVER=nvidia | |
HOLD_GPU=/usr/local/bin/hold_gpu.py | |
[ -x "$HOLD_GPU" ] || { echo "$HOLD_GPU is missing or not executable!"; exit 1; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os, time, shutil, heapq | |
MAX_CACHE_MB = 200 | |
_CACHED_FILES = [] | |
_CACHED_SIZE = None # in bytes | |
def cache_file(filename): | |
''' | |
Automatically maintain a cached version of the given filename. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "Minecraft Chatting Bot Daemon" | |
start on started minecraft | |
stop on stopping minecraft | |
chdir /home/daybreaker/minecraft/bin/mcbot | |
console log | |
pre-start script | |
sleep 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python3 | |
import os, sys | |
import subprocess | |
from datetime import datetime | |
def execute(cmd): | |
proc = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE) | |
stdout, stderr = proc.communicate() | |
return stdout.decode('utf-8') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!sh | |
#!/bin/bash | |
# | |
# Startup/shutdown script for nVidia CUDA | |
# | |
# chkconfig: 345 80 20 | |
# description: Startup/shutdown script for nVidia CUDA | |
# Source function library. | |
#. /etc/init.d/functions |