Skip to content

Instantly share code, notes, and snippets.

@kbroughton
kbroughton / slack_app.py
Created August 22, 2022 19:16
Slack app demonstrating client.chat_postMessage using Block Kit
import json
import logging
import os
from slack_sdk import WebClient
from slack_sdk.errors import SlackApiError
from slack_bolt import App, Ack
# WebClient instantiates a client that can call API methods
client = WebClient(token=os.environ.get("SLACK_BOT_TOKEN"))
logger = logging.getLogger(__name__)
denice
denita
dennis
derick
desirae
dev
developer
devicefarm
dewey
dick
Jenkinsfile (Pipeline with credentials management)
pipeline {
environment {
credentials = credentials('jenkins-gcp-service-account')
}
stages {
stage('Example stage 1') {
steps {
// use the credentials to upload to a Storage Bucket or
// push to gcr.io owned by company
@kbroughton
kbroughton / bash_kernel_wrapper.py
Last active June 4, 2022 00:48
persistent bash magics for jupyter notebook.
# Based on https://github.com/takluyver/bash_kernel/blob/master/bash_kernel/kernel.py
# But whereas bash_kernel interits BashKernel(Kernel), we must inject the kernel in the constructor
# BashKernel(object) and __init__(self, kernel, **kwargs)
from IPython.kernel.zmq.kernelbase import Kernel
from pexpect import replwrap, EOF
from subprocess import check_output
from os import unlink
@kbroughton
kbroughton / README
Created August 11, 2015 13:46
persistent bash cell embedded in python2 kernel
I understand why the above gist doesn't work. bash cells are created as sub-processes in a python2 kernel notebook. But is there a way to get persistence between %%bash cells so the output of the second would be foo?