Skip to content

Instantly share code, notes, and snippets.

View kylejeske's full-sized avatar
🐛
(!(while(succeed=try())));

kyle kylejeske

🐛
(!(while(succeed=try())));
  • Distributed
View GitHub Profile
@kylejeske
kylejeske / flatten.js
Created February 7, 2019 16:17
flatten object test
/**
* Takes a deeply nested object, `source`, and returns an object with
* dot-separated paths pointing to all primitive values from `source`.
*
* Examples:
*
* flatten({ foo: { bar: 1 } })
* //=> { 'foo.bar': 1 }
*
* flatten({ foo: [{ bar: 1 }, { bar: 2 }] })
@kylejeske
kylejeske / fetch-gpg-key.sh
Created April 3, 2019 11:13
Quick and easy: grab your GPG key
#!/bin/bash
printf "%s\n%s\n" "Note: This program assumes there is only 1 key (sec) assigned to a GPG Public key. If there is a secondary (ssb) assigned, this program WILL NOT work."
# Signing Commits and Assigning GPG Key to GitHub Account
# https://help.github.com/en/articles/signing-commits
# https://help.github.com/en/articles/associating-an-email-with-your-gpg-key
$(gpg --update-trustdb 2> 1)
# Fetch list-secret-keys & public key
@kylejeske
kylejeske / Dockerfile
Last active April 11, 2019 16:37
GitHub Action File - Yarn Repo
FROM node:11
LABEL "com.github.actions.name"="yarning for this"
LABEL "com.github.actions.description"="I yarn on this day."
LABEL "com.github.actions.icon"=""
LABEL "com.github.actions.color"="purple"
LABEL "repository"="https://gist.github.com/kylejeske"
LABEL "homepage"="https://github.com/kylejeske/"
LABEL "maintainer"="Kyle Jeske <[email protected]>"
@kylejeske
kylejeske / debug-sshd.sh
Created April 22, 2019 16:22
Debug SSHD Service
#!/bin/sh
# Run this on your server, and connect to port 2020.
sudo `which sshd` -p 2020 -Dd
@kylejeske
kylejeske / prep-for-sshfs-docker-plugin.sh
Created April 22, 2019 16:42
Pre-reqs for running a Docker plugin to handle SSHFS
#!/bin/sh
{
set -xe
# on alpine linux 3.8
# libfuse3.1+ required on linux
# https://github.com/libfuse/sshfs
# https://github.com/libfuse/libfuse
apk add fuse3
modprobe fuse3
docker plugin install vieux/sshfs --grant-all-permissions
@kylejeske
kylejeske / docker-related-in-proc.sh
Created April 23, 2019 12:03
Return a list of file system accesses and executables within proc
#!/bin/sh
{
set -e;
DKCMD=$(which docker);
## gcc, json, check
${FORMAT:-"gcc"};
${VERSION:-"v0.4.7"};
${FILE:-"not-magic-logic-based-scripts.sh"};
output=$("$DKCMD" run -v "$PWD:/mnt" "koalaman/shellcheck:${VERISON}" -f gcc "$FILE");
echo "$output"
@kylejeske
kylejeske / ansible-playbook-reference.yaml
Last active April 24, 2019 17:47
Ansible Reference Items by Index Position
hosts: all
vars:
file_path_1: /usr/bin
file_path_2: /example
file_path_3: /opt
tasks:
- name: example task
file:
path: "{{ item.0 }}/{{ item.1 }}"
state: present
@kylejeske
kylejeske / multistage.test.Dockerfile
Created April 24, 2019 17:51
Example of GoLang min build in Multi-Stage Dockerfile
FROM golang:alpine AS base-build
RUN apk update && apk add --no-cache git
WORKDIR $GOPATH/src/mypackage/myapp/
COPY . .
RUN go get -d -v
RUN go build -o /go/bin/hello
## using COPY
FROM scratch
## COPY --from=base-builder /go/bin/hello /go/bin/hello
@kylejeske
kylejeske / get-installed-alpine-packages.sh
Created April 26, 2019 10:17
Alpine Linux with APK package manager: Get installed packages and turn them into an install command
#!/bin/sh
# should print out:
# apk add [all packages installed]
{
set -e;
packages=$(apk info -vv | sort | awk "{print $1}" | cut -d" " -f0 | tr "\n" " ");
printf "apk add %s" "$packages";
exit 0;
} || echo "Something went wrong. Error: $!"; exit 1;