Skip to content

Instantly share code, notes, and snippets.

View JamesJJ's full-sized avatar
😺
Fantastic

JamesJJ JamesJJ

😺
Fantastic
  • Repositories and contributions under this account are personal not supported or endorsed by my current or previous employers.
  • Taiwan
View GitHub Profile
@JamesJJ
JamesJJ / Dockerfile-FROM-as-LABEL
Last active May 14, 2019 04:56
An example showing how to configure base image value once, use it in`FROM` and record it in a `LABEL`
ARG BASE_IMAGE=busybox:latest
FROM $BASE_IMAGE
ARG BASE_IMAGE
LABEL BASE_IMAGE="$BASE_IMAGE"
# other Dockerfile instructions . . .
aws ec2 --region ap-southeast-1 describe-instances \
--query 'Reservations[*].Instances[*].[InstanceId,Tags[?Key==`Name`].Value|[0],State.Name,PrivateIpAddress]' --output table
aws s3 ls \
| awk ' { print "aws s3api put-bucket-tagging --bucket " $3 " --tagging \"TagSet=[{Key=component,Value=" $3 "},{Key=service,Value=s3}]\"" }' \
| bash
using System;
public class Program
{
public static void Main()
{
// example values ...
var uriStringFromDgm = "http://blob-cn.htcvive.com/abc/123qwerty";
@JamesJJ
JamesJJ / aws-delete-iam-user.sh
Created May 24, 2018 10:37
Deleting_AWS_IAM_User_with_CLI_is_not_so_simple!
#!/bin/bash
U="$1"
[ -z "$U" ] && exit 1
which jq &> /dev/null || exit 2
echo "== $U"
@JamesJJ
JamesJJ / migrate_git.sh
Created April 24, 2018 08:35
Migrate GIT
#!/bin/bash
#FROM="git@hichub.example.com:web/frontend.git"
#TO="ssh://exampleengineering@vs-ssh.visualstudio.com:22/WEB/_ssh/frontend"
[ -z "${FROM}" ] && exit 1
[ -z "${TO}" ] && exit 1
TEMPDIR="$(mktemp -d /tmp/git.XXXXXX)"
git clone --mirror "${FROM}" "${TEMPDIR}" && \
# https://github.com/hadolint/hadolint
# This is an excellent tool for helping improve your Dockerfile
# As with all things, the default settings may not fit all use cases.
ignored:
- DL3017 # apk upgrade
- DL3005 # apt-get upgrade
- DL3018 # specify specific package versions with apk
- DL3008 # specify specific package versions with apt
@JamesJJ
JamesJJ / video_encode.sh
Last active May 12, 2022 18:15
FFMpeg commands for various video encoding
# val vrTranscodeMp4Args = AppConfigLib.getConfig[String]("CONTENT_VERIFY_TRANSCODE_MP4_ARGS").getOrElse(
# "-movflags faststart -c:v libx264 -s 1920x1080 -b:v 6M -c:a aac -b:a 128k -loglevel warning -y -nostats")
# val vrTranscodeWebmArgs = AppConfigLib.getConfig[String]("CONTENT_VERIFY_TRANSCODE_WEBM_ARGS").getOrElse(
# "-c:v libvpx -s 1920x1080 -crf 20 -b:v 6M -c:a libvorbis -slices 2 -threads 4 -loglevel warning -y -nostats")
# val mvrTranscodeMp4Args = AppConfigLib.getConfig[String]("CONTENT_VERIFY_TRANSCODE_MVR_MP4_ARGS").getOrElse(
# "-movflags faststart -pix_fmt yuv420p -profile:v main -level 4.1 -c:v libx264 -s 1280x720 -b:v 2M -c:a aac -b:a 128k -loglevel warning -y -nostats")
# val mvrTranscodeWebmArgs = AppConfigLib.getConfig[String]("CONTENT_VERIFY_TRANSCODE_MVR_WEBM_ARGS").getOrElse(
/*
project/sbt-native-packager.sbt:
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.23")
*/
// ...
// BASE IMAGE
dockerBaseImage := "openjdk:8-jre-slim-stretch"
FROM "<base-image>"
# FROM "openjdk:10-jre-slim"
# -------- OPS: Begin: Include security updates -------
RUN if test -f /etc/debian_version; then apt-get update && apt-get upgrade -y && rm -rf /var/lib/apt/lists/* ;fi
RUN if test -f /etc/alpine-release; then apk upgrade --no-cache -v ;fi
# -------- OPS: End: Include security updates -------
# Example: if you need bash in Alpine Linux