Skip to content

Instantly share code, notes, and snippets.

from funcinterface import FunctionInterface
class Function(FunctionInterface):
def run(self, request_data):
query = request_data['q']
tokens = query.split(",")
a, b = int(tokens[0]), int(tokens[1])
return str(a+b)
@allenlsy
allenlsy / vscode-prev-markdown.css
Last active May 22, 2020 05:03
markdown css for vscode md preview
h1, h2, h3, h4 {
margin-top: 2.5em;
}
h1 {
font-family: "Georgia", sans;
font-size: 2.4em;
text-transform: uppercase;
font-weight: bold;
}
@allenlsy
allenlsy / gist:33d86b85c8cbc444e91b05d440c14541
Last active April 9, 2020 00:58
pilot rbac log for authz config
Istio AuthorizationPolicy:
rules:
- to:
- operation:
methods: ["GET"]
- from:
- source:
namespaces: ["airmesh-test-authz-alpha"]
- from:
@allenlsy
allenlsy / multi-header-client.sh
Last active April 7, 2020 17:05
fortioserver test with multiple headers
#!/bin/bash
execTimes=$1
if [ -z ${execTimes} ]; then
execTimes=20
fi
totalTime=0
@allenlsy
allenlsy / istio-azp-debug.md
Created February 13, 2020 19:12
Istio Authz Policy debug log

Case 1:

  • Expected: Authorize HTTP requests with header required1=expected1 AND required2=expected2
  • Actual: Any header is allowed.

AuthorizationPolicy:

spec:
  selector:
@allenlsy
allenlsy / service-graph.yml
Created December 8, 2019 19:41
Simple network topology definition in WSIP
defaults:
requestSize: 1 KB
responseSize: 1 KB
numReplicas: 5
clientImage: tahler/fortio:prometheus
serverImage: tahler/isotope-service:1
services:
- name: a
- name: b
script:
@allenlsy
allenlsy / bootstrap-mac.sh
Last active July 24, 2019 07:39
bootstrap-dev-mac
# MAY NEED THIS IN RECOVERY MODE
# csrutil disable
# reboot
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# brew
brew tap caskroom/cask
# common tools
// First make sure the wrapper app is loaded
document.addEventListener("DOMContentLoaded", function() {
// Then get its webviews
let webviews = document.querySelectorAll(".TeamView webview");
// Fetch our CSS in parallel ahead of time
const cssPath = 'https://raw.githubusercontent.com/mallowigi/slack-one-dark-theme/master/custom.css';
let cssPromise = fetch(cssPath).then(response => response.text());
@allenlsy
allenlsy / slack-dark-theme.css
Last active September 30, 2018 23:02
slack-dark-theme
body { background: #222; color: #e6e6e6; }
a { color: #949494; }
a:link, a:visited { color: #949494; }
a:hover, a:active, a:focus { color: #c7c7c7; }
hr { border-bottom: 1px solid #424242; border-top: 1px solid #222; }
# Your init script
#
# Atom will evaluate this file each time a new window is opened. It is run
# after packages are loaded/activated and after the previous editor state
# has been restored.
#
# An example hack to log to the console when each text editor is saved.
#
# atom.workspace.observeTextEditors (editor) ->
# editor.onDidSave ->