Skip to content

Instantly share code, notes, and snippets.

@kesor
kesor / component-app.js
Last active Apr 5, 2021
Vue.js 3.x with ES6 modules in the browser using import-map
View component-app.js
import { defineAsyncComponent } from 'vue'
const Content = defineAsyncComponent(() => import('./component-content.js'))
export default {
name: 'App',
components: { Content },
template: /*html*/`
<Content />
`
@kesor
kesor / spec.json
Created Mar 31, 2021
Vega-Lite Seattle Weather
View spec.json
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"description": "Plot showing a 30 day rolling average with raw values in the background.",
"width": 800,
"height": 600,
"data": {"url": "data/seattle-weather.csv"},
"transform": [{
"window": [
{
"field": "temp_max",
@kesor
kesor / profile_middleware.py
Last active Mar 16, 2021
Django cProfile middleware
View profile_middleware.py
from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
import cProfile
import pstats
import marshal
from cStringIO import StringIO
class ProfileMiddleware(object):
def __init__(self):
if not settings.DEBUG:
@kesor
kesor / AWS Security Resources.md
Last active Feb 4, 2021 — forked from chanj/AWS Security Resources
AWS Security Resources
View AWS Security Resources.md
@kesor
kesor / Dockerfile
Last active Jan 22, 2021
Compile DENO on Alpine (w/MUSL C)
View Dockerfile
FROM rust:alpine
RUN apk add --no-cache \
bash \
binutils-gold \
ca-certificates \
clang \
curl \
g++ \
git \
@kesor
kesor / cloudtrail-template-elasticsearch.json
Last active Oct 5, 2020
An ElasticSearch Index template for CloudTrail events
View cloudtrail-template-elasticsearch.json
PUT _template/cloudtrail
{
"index_patterns": ["cloudtrail-*"],
"settings": {
"number_of_shards": 1,
"mapping": {
"total_fields": {
"limit": 10000
}
}
View example.sh
function get_cluster_name() {
if ! kubectl config current-context ; then
echo "ERROR: Could not read kubeconfig context" 2>&1
exit 1
fi
}
CLUSTER_NAME=$(get_cluster_name)
@kesor
kesor / docker_workshop_microservices_cheat_sheet.md
Last active Sep 27, 2020
docker workshop cheat sheet #2 - microservices
View docker_workshop_microservices_cheat_sheet.md
View filebeat.yaml
filebeat.autodiscover:
providers:
# documented at https://www.elastic.co/guide/en/beats/filebeat/master/configuration-autodiscover.html
- type: kubernetes
host: ${NODE_NAME}
hints.enabled: true
hints.default_config:
type: container
paths:
- /var/log/containers/*${data.kubernetes.container.id}.log
@kesor
kesor / kops-cluster-update-errors.txt
Created Sep 1, 2020
kops cluster update duplicate IAM roles
View kops-cluster-update-errors.txt
I0901 15:06:00.194412 65709 factory.go:68] state store s3://mybucket.domain.com/mycluster
I0901 15:06:00.194584 65709 s3context.go:337] GOOS="darwin", assuming not running on EC2
I0901 15:06:00.194592 65709 s3context.go:170] defaulting region to "us-east-1"
I0901 15:06:00.987020 65709 s3context.go:210] found bucket in region "us-east-1"
I0901 15:06:00.987048 65709 s3fs.go:284] Reading file "s3://mybucket.domain.com/mycluster/mycluster.domain.com/config"
I0901 15:06:01.770731 65709 s3fs.go:321] Listing objects in S3 bucket "mybucket.domain.com" with prefix "mycluster/mycluster.domain.com/instancegroup/"
I0901 15:06:01.978948 65709 s3fs.go:349] Listed files in s3://mybucket.domain.com/mycluster/mycluster.domain.com/instancegroup: [s3://mybucket.domain.com/mycluster/mycluster.domain.com/instancegroup/master-us-east-1a s3://mybucket.domain.com/mycluster/mycluster.domain.com/instancegroup/nodes s3://mybucket.domain.com/mycluster/mycluster.domain.com/instancegroup/second]
I0901 15:06:01.978996 65709