Skip to content

Instantly share code, notes, and snippets.

View blurayne's full-sized avatar

Markus Geiger blurayne

View GitHub Profile
@blurayne
blurayne / 01-logging.sh
Last active January 23, 2019 23:42
Prevent stderr written before stdout
#!/bin/bash
##
# Logging of bash output and preventing stderr written before stdout
#
# If STDERR is not relvant to yout consider using `exec 1&>>(logger) 2>&1`
#
# Culprit is Unix stdio buffering, as implemented on Linux by glibc which is a system library
# that most programs implemented in C use to handle basic stuff (e.g., IO).
#

Start an ssh-agent

If not yet done add to your rc-file ike .bashrc or .zshrc

$ eval `ssh-agent`

Add your generated key

GitHub.com: GIT Directory-Based Configs

About

So, you are a proud OpenSource developer and work for a company using GitHub.com for GIT repository hosting?

While SSH auth to GitHub.com is based on public keys and it automatically chooses the right account you have to take care when you quickly clone a repository, change something and whoops your company has your private email address or hacker pseudo within their repository.

The scenario we are speaking about looks like following:

@blurayne
blurayne / ssh-aws-ec2-instance
Last active February 13, 2019 20:10
SSH to EC2 using peco and awless
#!/bin/bash
###
# SSH to AWS EC2 instances using peco and awless
#
# - Generate a cache of AWS instances
# - Open peco to select one or more server and either open ssh or tmux-css
# - Does not use `awless ssh` since prefererence on ‘security by obscurity’
#
# Dependencies
@blurayne
blurayne / snowflake-reconnaisance.md
Created June 7, 2019 11:43
Snowflake reconnaisance

Snowflake Reconnaissance

About

This page will assist you in retrieving important information from so called Snowflake Server which exist in your infrastructure unversioned and with unknown status. The basic idea is that system files in a modern system are under packages control, which enables us to do following:

  • verify files and look for changed and missing files and other diversions
  • identify files that do not belong to the system
  • enable you to do a proper backup of the important (changed) files only
  • and effectively transform a snowflake to become part of your fleet (IaC)
@blurayne
blurayne / 1-README.md
Last active September 11, 2019 16:52
Variable types in BASH (typeof implementation)

Myth about associative arrays in BASH

To be clear: It's possible to pass associative arrays in BASH.

TL;DR you probably didn't RTFM so please njoy following session!

CODE

Pass an associative array the correct-BASH way

@blurayne
blurayne / confluence.lua
Created March 18, 2021 13:57
Pandoc Converters
-- This is a sample custom writer for pandoc. It produces output
-- that is very similar to that of pandoc's HTML writer.
-- There is one new feature: code blocks marked with class 'dot'
-- are piped through graphviz and images are included in the HTML
-- output using 'data:' URLs.
--
-- Invoke with: pandoc -t sample.lua
--
-- Note: you need not have lua installed on your system to use this
-- custom writer. However, if you do have lua installed, you can
@blurayne
blurayne / README.md
Last active March 26, 2021 13:59
Did CodeCentric censor me?

In response to: https://blog.codecentric.de/en/2021/03/github-actions-nextgen-cicd/

GitLab CI has templates you could use. Only bad thing is they did is they way they launch their job containers (defaulting to BASH/SH interpreter and preprocessing script section). This is a bit limiting in using custom containers for integration. But you can do as well.

GitHub actions do have their action params which make them nice for for validation, also they focused more on the API but I do see actions also as way of monetizing integration which is the cloud's OpenSource business model.

And here we are with Tekton or even AWS CodePipeline which could be more seen as CloudPipeline. The questions is how a CICD becomes cloud native? And one part of the answer is integration with Cloud and Services API. That's more about the paradigm shift of the "third" wave.

Also a simple CICD became now a build platform that integrate into the layers of the cloud, mainly orchestrators and solve the problems of how artifacts and data fl

@blurayne
blurayne / ssh-copy-key
Last active July 1, 2022 23:01
ssh-copy-key
#!/bin/bash
# vim:tabstop=2 softtabstop=2 shiftwidth=2 noexpandtab
# vim:syntax=sh
##
# ssh-copy-key - a better ssh-copy-id
#
# - have a different identify file to copy to remote host (and just one!)
# - (infrastructure where you don't own private key but wanna role out your private key –like it should be done ;)
# - automatically generates public key if not yet given
@blurayne
blurayne / install-ssm-agent.sh
Last active July 5, 2022 19:03
AWS Helpers
#!/bin/bash
set -eEuo pipefail
ARCH="$(arch)"
PACKAGE_ARCH="${ARCH/x86_64/amd64}"
PACKAGE_ARCH="${PACKAGE_ARCH/aarch64/arm64}"
PACKAGE_URL=""
PACKAGE_FILE=""