Skip to content

Instantly share code, notes, and snippets.

View dantheman213's full-sized avatar
๐Ÿš€

Dan dantheman213

๐Ÿš€
View GitHub Profile
@dantheman213
dantheman213 / secrets_manager_kubernetes.sh
Created January 12, 2018 03:18
Easily get or set secrets to or from the Google Cloud to your local repo for Docker dev.
#!/bin/bash
# Description: Easily get or set secrets to or from the Google Cloud to your local repo for Docker dev.
# Dependencies: kubectl (logged in with permissions to access kubernetes), jq
# Installation: To install, just move into /usr/local/bin/ and make sure it has execute permissions
set -e # halt on errors
# Set script vars
@dantheman213
dantheman213 / reset_files_lf_encoding.sh
Created March 7, 2018 20:35
Change all files in a dir from CRLF to LF file encoding
find . -type f -print0 | xargs -0 dos2unix
@dantheman213
dantheman213 / random_string.sh
Last active December 3, 2018 07:44
Bash Shell Script Cross-platform Generate Random String Easily With Pre-Installed System Tools
#!/bin/bash
# Bash Shell Script Cross-platform Generate Random String Easily With Pre-Installed System Tools
MD5_BIN="md5sum" # default for windows git bash and linux
COMMAND_OUTPUT=$(command -v md5sum)
if [ ${#COMMAND_OUTPUT} -lt 1 ]; then
MD5_BIN="md5" # OSX
fi
@dantheman213
dantheman213 / Dockerfile
Created April 29, 2018 21:07
Node JS Bootstrap Run Environment w/ run script that can inject secret env vars locally or into Docker or Kubernetes
# NodeJS v6 official image
FROM node:boron
EXPOSE 8080
EXPOSE 9229
WORKDIR /opt/app
RUN npm install -g node-sass grunt grunt-cli grunt-sass
@dantheman213
dantheman213 / cloudsql-proxy.service
Created May 12, 2018 00:57
Systemd start-up script for Google Cloud SQL Proxy for Postgres
[Install]
WantedBy=multi-user.target
[Unit]
Description=Google Cloud Compute Engine SQL Proxy
Requires=network.target
After=network.target
[Service]
Type=simple
@dantheman213
dantheman213 / install_great_gnu_screen_config.sh
Last active May 10, 2020 05:05
Download a great Gnu Screen config straight to your current user's environment
#
# Download a great Gnu Screen config straight to your current user's environment
#
# Just paste that in wherever env you're at and run `screen` and you'll have a good configuration with a status bar,
# tabs, no warning screen, beeps/bells/alerts, and more.
#
# Screen Config (.screenrc) located here:
# Gist: https://gist.github.com/dantheman213/8df6fabb1bc6fc192c9e
# Raw: https://gist.githubusercontent.com/dantheman213/8df6fabb1bc6fc192c9e/raw/bfd65a3695974b94223849c516b5b58828932613/Great%2520GNU%2520Screen%2520config
@dantheman213
dantheman213 / README.md
Last active May 12, 2018 17:41
Youtube Download Cheatsheet

Youtube Download Cheatsheet

Download and install binary here: https://github.com/rg3/youtube-dl

Get Best Video and Audio

youtube-dl.exe -f "best[ext=mp4]" --no-check-certificate <VIDEO URL>

Get worst video no audio

youtube-dl.exe -f "worstvideo[ext=mp4]" --no-check-certificate

@dantheman213
dantheman213 / main.sh
Created July 17, 2018 03:56
Read every line of an environment variable file for Docker in as a standard bash script.
while read fileLine; do echo "Exporting ${fileLine}...\n"; export ${fileLine}; done < secrets.env
// EX: secrets.env
// MY_VAR=123
// MY_API_KEY=ASDFKJDSFJL234545
@dantheman213
dantheman213 / docker_cheat_sheet_readme.MD
Last active April 27, 2020 00:43
Docker Cheat Sheet

Docker Cheat Sheet

Copy file from container to host

docker cp <containerId>:/file/path/within/container /host/path/target

Stop all running containers

docker stop $(docker ps -aq)
@dantheman213
dantheman213 / Dockerfile
Last active September 28, 2018 17:55
Go Dockerfile Example
# Dockerfile for basic Go application example
#
# Assumptions
# - There is a project dir
# - Inside the project dir, there is the path src/main
# - The project's *.go files are located in src/main
# - The project's name is "myapp"
FROM golang:1.11.0-stretch AS packager