Skip to content

Instantly share code, notes, and snippets.

View developer-guy's full-sized avatar
🐾
Every artifact can be verifiably traced to Source Code and Hardware

Batuhan Apaydın developer-guy

🐾
Every artifact can be verifiably traced to Source Code and Hardware
View GitHub Profile
@developer-guy
developer-guy / kubernetes_add_service_account_kubeconfig.sh
Created January 14, 2020 05:37 — forked from innovia/kubernetes_add_service_account_kubeconfig.sh
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@developer-guy
developer-guy / get-latest-tag-on-git.sh
Created August 11, 2020 06:53 — forked from rponte/get-latest-tag-on-git.sh
Getting latest tag on git repository
# The command finds the most recent tag that is reachable from a commit.
# If the tag points to the commit, then only the tag is shown.
# Otherwise, it suffixes the tag name with the number of additional commits on top of the tagged object
# and the abbreviated object name of the most recent commit.
git describe
# With --abbrev set to 0, the command can be used to find the closest tagname without any suffix:
git describe --abbrev=0
# other examples
$ export PATH=$(pwd):$PATH
$ podman-machine create box
Podman machine "box" already exists
$ podman-machine start box
Starting "box"...
@developer-guy
developer-guy / Podman-on-MacOS.md
Created October 1, 2020 06:51 — forked from rbo/Podman-on-MacOS.md
Podman on Mac OS
$ export PATH=$(pwd):$PATH
$ podman-machine create box
Podman machine "box" already exists
$ podman-machine start box
Starting "box"...
@developer-guy
developer-guy / brew-list.sh
Created October 5, 2020 06:30 — forked from eguven/brew-list.sh
List all packages installed using Homebrew and their sizes
brew list | xargs -n1 -P8 -I {} \
sh -c "brew info {} | egrep '[0-9]* files, ' | sed 's/^.*[0-9]* files, \(.*\)).*$/{} \1/'" | \
sort -h -r -k2 - | column -t
@developer-guy
developer-guy / .gitlab-ci.yml
Created October 6, 2020 12:10 — forked from alediaferia/.gitlab-ci.yml
GitLab CI example snippet for building and releasing images to Heroku
stages:
- build
- release
build_image:
only:
- master
image: registry.gitlab.com/majorhayden/container-buildah
stage: build
variables:
@developer-guy
developer-guy / docker-for-mac.md
Created October 8, 2020 07:31 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker for Mac Moby VM

2018 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Moby VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@developer-guy
developer-guy / kustomize-deploy.sh
Created October 13, 2020 07:55 — forked from colinjfw/kustomize-deploy.sh
Kubernetes deployment strategy using Kustomize and a few basic tools. Replaces helm charts with simple tooling solutions.
# Kustomize based apply workflow. Requires jq, yq, kubectl, kustomize, mustache.
#
# Expected variables
# - namespace Namespace for all resources.
# - release A unique name to give to this collection of manifests.
# - revision Release revision.
# - images Image replacements.
# - variables Variable replacements.
#
# Example inputs:
@developer-guy
developer-guy / Dockerfile
Created October 14, 2020 12:47 — forked from alkrauss48/Dockerfile
Running a docker container as a non-root user
# By default, Docker containers run as the root user. This is bad because:
# 1) You're more likely to modify up settings that you shouldn't be
# 2) If an attacker gets access to your container - well, that's bad if they're root.
# Here's how you can run change a Docker container to run as a non-root user
## CREATE APP USER ##
# Create the home directory for the new app user.
RUN mkdir -p /home/app
@developer-guy
developer-guy / pair-program-tmux.md
Created October 15, 2020 10:09 — forked from shrayasr/pair-program-tmux.md
Pair programming with Tmux

Pair programming with Tmux

Using the same user

User 1

  1. SSH into the box

     user1@user1-machine$ ssh user@host