Skip to content

Instantly share code, notes, and snippets.

@allenlsy
allenlsy / ctagsrb
Created August 4, 2015 03:02
Generate ctags file fo ruby gems
#!/usr/bin/env ruby
# system "find . -name '*.rb' | ctags -f .tags -L -"
if File.exist? './Gemfile'
require 'bundler'
paths = Bundler.load.specs.map(&:full_gem_path).join(' ')
system "ctags -R -f .gemtags #{paths}"
end
@allenlsy
allenlsy / install_docker.sh
Created July 12, 2017 07:42 — forked from dpp/install_docker.sh
A script to install Docker on a minimal Ubuntu 16.04 machine
#!/bin/bash
apt-get update
apt-get install -y apt-transport-https ca-certificates
apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
echo 'deb https://apt.dockerproject.org/repo ubuntu-xenial main' > /etc/apt/sources.list.d/docker.list
apt-get update
# 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 ->
@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; }
// 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 / 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
@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 / 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 / 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 / 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: