Skip to content

Instantly share code, notes, and snippets.

Avatar

david amick snarlysodboxer

View GitHub Profile
View yamllint-config
# .config/yamllint/config
---
extends: default
rules:
empty-lines:
max-end: 1
indentation:
indent-sequences: false
line-length:
@snarlysodboxer
snarlysodboxer / swap-imports.sh
Created Jun 4, 2020
Swap Go Imports, for working with forked repos
View swap-imports.sh
#!/bin/bash
if [ "$1" != "snarly" ] && [ "$1" != "fr" ]; then
echo "specify snarly or fr"
exit 1
fi
if [ "$1" == "snarly" ]; then
find . -name '*.go' | xargs sed -i.bak 's/ForgeRock\/secret-agent/snarlysodboxer\/secret-agent/'
sed -i.bak 's/ForgeRock\/secret-agent/snarlysodboxer\/secret-agent/' go.mod
@snarlysodboxer
snarlysodboxer / scaling_flat_file_ops.md
Created Jul 13, 2018
Notes on scaling file uploads, storage, retrieval, & background processing.
View scaling_flat_file_ops.md

Scaling file uploads, storage, retrieval, & background processing

Storage

Object store systems like Openstack Swift, Minio, and Ceph are worth consideration. They offer various advantages in scalability, accessibility, and things like arbitrary object metadata. Most of them also have S3 compatible APIs if that makes things easier.

If instead we need or desire to read files from traditional mounted filesystems, GlusterFS is one option worth considering. With it's Distributed Replicated configuration, storage space can be scaled by adding more disks, and access speed can be scaled by adding more nodes. It's supported by Kubernetes, and has systems for asynchronous replication, usually used for syncing the data to another datacenter. It can support replicate

@snarlysodboxer
snarlysodboxer / main.go
Last active Jul 6, 2018
dead man switch, and other options
View main.go
package main
import (
"flag"
"fmt"
"os"
"syscall"
"time"
)
@snarlysodboxer
snarlysodboxer / hambone_train_of_thought.md
Last active Jul 5, 2018
Train of thought for the development of hambone
View hambone_train_of_thought.md
  • We want an API server for CRUDing nearly identical k8s specs, but want to be able to customize anything about any one of them.
  • Chose gRPC/Protocol Buffers for the API, primarily for the free code generation, but also for the advanced networking smarts built into gRPC. Swagger docs and a JSON/Rest gateway can be auto-generated from the proto file.
  • A major goal for the project is replica safety. - We want to run multiple copies of the API server to eliminate the majority of types of downtime for clients.
  • I went through 2 major re-writes on this project.
    • The first version was a quick spike as a Golang package for use in custom apps. It uses jq (and yq) to render yaml templates and apply them via kubectl.
    • I then decided that with the right abstractions an open source app could be developed (hambone).
    • hambone's first version was built as a standalone binary, with plug-able state storage and k8s adapters. It hoped to avoid executing other processes (often miss-referenced as "shelling out",) and
View bumpme
Mon Aug 15 17:26:01 UTC 2016
@snarlysodboxer
snarlysodboxer / mtrak.conf
Last active Aug 13, 2016
A config for Macbook Pro trackpad in mtrak in Ubuntu. https://github.com/BlueDragonX/xf86-input-mtrack/
View mtrak.conf
Section "InputClass"
MatchIsTouchpad "on"
Identifier "Touchpads"
Driver "mtrack"
# TrackpadDisable - Disables trackpad touch input. A value of 0 will enable the trackpad. A value of 1 will disable tapping and gestures but not movement. A value of 2 will disable all input. A value of 3 will also disable physical buttons. Integer. Default is 0.
# Sensitivity - Adjusts the sensitivity (movement speed) of the touchpad. This is a real number greater than or equal to zero. Default is 1. A value of 0 will disable pointer movement.
Option "Sensitivity" "0.65"
# FingerHigh - Defines the pressure at which a finger is detected as a touch. This is a percentage represented as an integer. Default is 5.
Option "FingerHigh" "12"
# FingerLow - Defines the pressure at which a finger is detected as a release. This is a percentage represented as an integer. Default is 5.
@snarlysodboxer
snarlysodboxer / find_duplicates.rb
Created Jan 30, 2016
Find (and optionally delete) duplicate files in directories using md5sum
View find_duplicates.rb
#!/usr/bin/env ruby
# Usage:
# `./find_duplicates.rb 'directory to search*'` for a dry run, and
# `./find_duplicates.rb 'directory to search*' --delete` to actually delete the duplicates.
find_path = ARGV[0]
delete = false
delete = true if ARGV[1] == "--delete"
files = `find #{find_path} -type f`.split "\n"
@snarlysodboxer
snarlysodboxer / white_space_police.sh
Created Dec 21, 2015
White space police for Ruby files
View white_space_police.sh
#!/bin/bash
# remove trailing whitespace
find ./ -name '*.rb' -exec sed -i "s/\s\+$//g" {} +
# switch tabs for two spaces
find ./ -name '*.rb' -exec sed -i "s/\t/ /g" {} +
# auto indent with Vim
# open any file in Vim, then:
:args ~/code/myproject/**/*.rb | argdo execute "normal gg=G" | update
View strange VOLUME behavior.md

this:

FROM localhost:5000/ubuntu/base-12.04:latest
MAINTAINER The CTI Solutions Inc. Team

ADD delete_me_code/ /var/www/current/

RUN mkdir /var/www/current/log
RUN mkdir /var/www/current/tmp
RUN mkdir /var/www/current/var