Skip to content

Instantly share code, notes, and snippets.

View zqbake's full-sized avatar

BAKEZQ zqbake

View GitHub Profile
@zqbake
zqbake / docker-automation.py
Created May 8, 2021 14:11 — forked from yetanotherchris/docker-automation.py
Automating Docker images and containers with Python ()
'''
This script brings up the entire stack of Docker containers, removing the current ones.
Docker compose was tried for this task and it wasn't customisable enough.
Docker cloud was tried (with stack files) and was buggy (failed to launch, no logs returned).
Docker machine was tried, but it can't connect to existing servers only ones it created.
Rancher was too heavy weight for the task, as the containers are lightweight in DigitalOcean.
Kubernetes would've been too heavy weight for DigitalOcean.
It was written in Powershell and worked. But then converting it to Bash was too much effort.
Powershell for Linux is too much effort to install without a debian package (and none standard)
@zqbake
zqbake / git_new_local_branch.md
Created April 30, 2021 18:21 — forked from nanusdad/git_new_local_branch.md
Git - create new local branch push to GitHub
@zqbake
zqbake / python_named_pipe.py
Created March 22, 2021 13:07 — forked from komuw/python_named_pipe.py
python named pipe
import os
import errno
import time
"""
The linux pipe buffers are implemnted as circular buffers[1].
A consequence of the circular buffer is that when it is full and a subsequent write is performed:
(a) then it starts overwriting the oldest data[2].
(b) Alternatively, the routines that manage the buffer could prevent overwriting the data and return an error or raise an exception.
from flowsaber.api import *
@task
def task1(name: str):
print('read', name)
return "Helloed " + name
@task
def task2(name1, name2):
return name1 + "-" + name2
@zqbake
zqbake / task.py
Last active March 22, 2021 08:49
def task1(name: str):
print("hello", name)
return "Helloed " + name
@zqbake
zqbake / create_function.py
Created March 8, 2021 17:51 — forked from dsuess/create_function.py
Dynamic function creation in Python
"""
Python is a dynamic language, and it is relatively easy to dynamically create
and modify things such as classes and objects. Functions, however, are quite
challenging to create dynamically.
One area where we might want to do this is in an RPC library, where a function
defined on a server needs to be available remotely on a client.
The naive solution is to simply pass arguments to a generic function that
accepts `*args` and `**kwargs`. A lot of information is lost with this approach,
however, in particular the number of arguments taken. Used in an RPC
implementation, this also delays any error feedback until after the arguments
@zqbake
zqbake / cloudSettings
Last active June 30, 2020 09:01
vscode config
{"lastUpload":"2020-06-30T09:01:36.929Z","extensionVersion":"v3.4.3"}