Skip to content

Instantly share code, notes, and snippets.

View leonmax's full-sized avatar

Yangming leonmax

View GitHub Profile
@leonmax
leonmax / exec.py
Last active September 12, 2021 20:15
sample to run subprocess and log stdout/stderr with asyncio
__author__ = 'leonmax'
import asyncio
from asyncio import (coroutine, subprocess)
import sys
import logging
FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(level=logging.INFO, format=FORMAT)
var AWS = require('aws-sdk');
var s3 = new AWS.S3();
var getUrl = function(bucket, path, callback) {
var params = {Bucket: bucket, Key: path};
s3.getSignedUrl('getObject', params, callback);
}
@leonmax
leonmax / nav.lua
Last active August 29, 2015 14:02
nav module for turtle in computercraft
local SlotManager = {}
SlotManager.__index = SlotManager
function SlotManager.new()
local self = setmetatable({}, SlotManager)
self.selectedSlot = 1
return self
end
function SlotManager:select(s)