Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Hack the 🌎!

Derek Ditch dcode

💭
Hack the 🌎!
View GitHub Profile
@dcode
dcode / local-mirrors.repo
Created Jan 29, 2021
Quick dirty script to maintain local repo mirrors. Serve up with httpd, nginx, or whatever
View local-mirrors.repo
# Add this file to /etc/yum.repos.d/local-mirrors.repo
# Change the IP below accordingly
[mirror-base]
name=Base mirror
baseurl=http://192.168.100.10/base
enabled=1
cost=500
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
@dcode
dcode / es_stack_cleanup.bash
Created Nov 17, 2020
Kibana and Elasticsearch cleanup
View es_stack_cleanup.bash
# Uses `httpie` since it's more convenient than `curl`
# Uses `jq` to filter JSON response
function clear_kibana() {
ES_DEFAULT='elastic:password'
ES_AUTH="${ES_AUTH:-$ES_DEFAULT}"
KIBANA_DEFAULT="http://${ES_AUTH}@127.0.0.1:5601"
KIBANA_API="${KIBANA_API:-$KIBANA_DEFAULT}"
OBJECTS=$( http GET "${KIBANA_API}/api/saved_objects/_find" \
kbn-xsrf:true \
@dcode
dcode / delete_kibana_saved_objects.bash
Last active Nov 16, 2020
Delete all Kibana saved objects. This is useful if you're developing beats modules or just want to clear out some cruft. Works with 7.x API.
View delete_kibana_saved_objects.bash
#!/bin/bash
# From the docs: https://www.elastic.co/guide/en/kibana/current/saved-objects-api-get.html#saved-objects-api-get-params
# Types can be: visualization, dashboard, search, index-pattern, config, timelion-sheet
# You can also have a map type, which isn't in the docs linked above
export KIBANA_API_URL='http://elastic:password@127.0.0.1:5601'
export OBJECTS=$(curl "${KIBANA_API_URL}/api/saved_objects/_find?fields=id&type=index-pattern&type=visualization&type=dashboard&type=search&type=index-pattern&type=timelion-sheet&type=map&per_page=1000" | jq -rc '.saved_objects[] | {"type": .type, "id": .id } | @base64')
# Loops through the base64-encoded JSON objects
@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 Jul 23, 2020
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 Jul 16, 2020
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