Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Hack the 🌎!

Derek Ditch dcode

💭
Hack the 🌎!
  • Elastic
  • Texas
  • Twitter @dcode
View GitHub Profile
@dcode
dcode / docker-compose.yml
Created Oct 7, 2020
Docker compose to standup a local minimal Kafka cluster, useful for development purposes. Can connect from host on port 9093/tcp.
View docker-compose.yml
version: '2'
services:
zookeeper:
image: 'docker.io/bitnami/zookeeper:3-debian-10'
ports:
- '2181:2181'
networks:
- 'data-tier'
volumes:
@dcode
dcode / install-driver.ps1
Created Aug 14, 2020
This is the Google Compute Engine install-driver file used for windows driver installation. I couldn't find it anywhere else online.
View install-driver.ps1
#Copyright 2018 Google, Inc. All Rights Reserved.
<#
.SYNOPSIS
Script to install specific driver.
.DESCRIPTION
Script will add certs from the driver to TrustedPublisher store and
install driver with pnputil.
NOTE: The script needs to be run with admin priviledge.
View install_googet.ps1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
Invoke-WebRequest https://github.com/google/googet/releases/download/v2.13.0/googet.exe -OutFile $env:temp\googet.exe;
& "$env:temp\googet.exe" -root C:\ProgramData\GooGet -noconfirm install -sources `
https://packages.cloud.google.com/yuck/repos/google-compute-engine-stable googet;
Remove-Item "$env:temp\googet.exe"
@dcode
dcode / Guest OS Descriptors by VMware Platform.md
Last active Jun 29, 2022
When using Packer (or other vmx editing needs), I needed to know what the `guest_os_type` should be according to what platform it was running on. Here you go. If it isn't listed in a column, it didn't exist at that time.
View Guest OS Descriptors by VMware Platform.md
ESXi 6.5 ESXi 6.7 VMware Fusion 11 Guest Description
CRXPod1-64 VMware CRX Pod 1
CRXSys1-64 VMware CRX Sys 1
amazonlinux2-64 Amazon Linux 2 or higher, 64-Bit
asianux3Guest asianux3Guest asianux3 Asianux Server 3
asianux3_64Guest asianux3_64Guest asianux3-64 Asianux Server 3, 64-Bit
asianux4Guest asianux4Guest asianux4 Asia Linux 4
asianux4_64Guest asianux4_64Guest as
@dcode
dcode / fanimation_notes.txt
Last active Dec 23, 2021
Notes about Fanimation BTLE interface
View fanimation_notes.txt
# Fan List
Sitting Area b0:7e:11:fe:5f:73
Patio 78:04:73:18:bf:8b
Living Room 78:04:73:18:ea:20
# primary
attr handle 0x0001, end grp handle 0x0009 uuid 539c6813-0ad0-2137-4f79-bf1a11984790
attr handle 0x000a, end grp handle 0x0014 uuid 00001800-0000-1000-8000-00805f9b34fb
attr handle 0x0015, end grp handle 0xffff uuid 0000e000-0000-1000-8000-00805f9b34fb
@dcode
dcode / Dockerfile
Created Jun 2, 2020
Fedora CoreOS CT snippet and dockerfile to run open-vm-tools in a container for VMware guests
View Dockerfile
FROM fedora:31
LABEL summary="The open-vm-tools guest agent" \
io.k8s.description="The open-vm-tools agent is providing information about the virtual machine and allows to restart / shutdown the machine via VMware products. This image is intended to be used with virtual machines running Centos Atomic Host." \
io.k8s.display-name="open-vm-tools guest agent" \
architecture="x86_64" \
BZComponent="open-vm-tools" \
maintainer="davis phillips <dphillip@redhat.com>"
ENV SYSTEMD_IGNORE_CHROOT=1
@dcode
dcode / mirror-images.yml
Created May 22, 2020
Ansible playbook to pull docker images, write them to disk as tarballs, then optionally restore them to local container storage
View mirror-images.yml
---
- hosts: localhost
become: True
vars:
archive_path: /home/vagrant/containers
containers:
- name: quay.io/dcode/strelka_manager
tag: latest
id: 8b8321cf9c81
- name: quay.io/dcode/strelka_frontend
@dcode
dcode / generate_password_hash.sh
Last active May 18, 2020 — forked from vivianspencer/gist:1bf32ef808e7a8863d8e6c461d885278
generate SHA512 hashed and verified passwords on OSX with either python2 or python3. Should work on other platforms as well.
View generate_password_hash.sh
pip install passlib
cat << EOF | python
from __future__ import print_function;
from passlib.hash import sha512_crypt;
import getpass;
import sys, os;
hash = sha512_crypt.hash(getpass.getpass())
if sha512_crypt.verify(getpass.getpass("Verify password:"), hash):
@dcode
dcode / filter-flatten-nested.conf
Last active Oct 22, 2021
Logstash ruby filter to flatten nested fields to dotted names. I don't recommend this for many reaons (performance, json parsing pain, elasticsearch indexing problems, etc), but sometimes your data pipeline requires this sort of silliness.
View filter-flatten-nested.conf
filter {
ruby {
path => 'flatten_nested_field.rb'
script_params => {
"source" => "observer"
"delimiter" => "."
}
}
}
@dcode
dcode / _CLI_Elasticsearch_Analysis.md
Last active Aug 19, 2021
Analyze Elasticsearch on command line using HTTPie and jq
View _CLI_Elasticsearch_Analysis.md

README

Especially when developing new query logic, it's helpful to query elasticsearch from the command line. If your Elasticsearch cluster uses SAML authentication or some other SSO, it's not simple or sometimes not even possible to query using curl directly. I wrote an auth plugin for HTTPie that should greatly simplify this process if you have rights to create API keys via the Kibana dev console (talk to your administrator and see the link below).

This process is also super handy for shell scripting because you can provide fine-grained limits of what your API key can do, making their use much safer and easier to manage than embedding native realm username/passwords.