Skip to content

Instantly share code, notes, and snippets.

@inyee786
inyee786 / Dockerfile
Last active May 1, 2023 08:45
Deploy SPA on Kubernetes
# Stage 0, "build-stage", based on Node.js, to build and compile the frontend
FROM node:10.8.0 as build-stage
WORKDIR /app
COPY package*.json /app/
RUN npm install
COPY ./ /app/
ARG configuration=production
RUN npm run build -- --output-path=./dist/out --configuration $configuration
# Stage 1, based on Nginx, to have only the compiled app, ready for production with Nginx
@borekb
borekb / README.md
Last active June 29, 2026 11:07
Docker and Git Bash / MSYS2 on Windows: path conversion workaround

👋 Moved to https://github.com/borekb/docker-path-workaround


Docker in Git Bash / MSYS2 on Windows: path conversion workaround

UPDATE 07/2018: I switched from Git Bash to MSYS2 recently which should be very similar, if not the same, but there some subtle differences which made me realize this is more tricky than I thought and that I don't 100% understand what is going on. If someone can help, please let me know in the comments.

Invoking docker in MSYS2 shell or Git Bash typically fails with complains about paths, for example:

@megahertz
megahertz / mongo-url.sh
Created February 28, 2018 04:10
Parse MongoDB connection string in bash
#!/usr/bin/env bash
set -e
# Usage: parse_mongo_url URL
# It sets the following variables:
# MONGO_HOST
# MONGO_PORT
# MONGO_DATABASE
# MONGO_USER
# MONGO_PASSWORD
@DarrenN
DarrenN / get-npm-package-version
Last active June 20, 2025 19:20 — forked from yvele/get-npm-package-version.sh
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@moudrick
moudrick / main.rb
Last active June 9, 2026 20:42 — forked from farmisen/main.rb
Unpacks *.pvr.ccz back to PNG fixed issue with [[invalid regular expression; there's no previous pattern, to which '{' would define cardinality]] Thanks to the initial author who implemented the whole workflow! Thank to those who included RUBY into OSX out-of-box!
require 'rubygems'
require 'json'
require 'chunky_png'
PLUTIL = '/usr/bin/plutil'
TEXTUREPACKER = '/usr/local/bin/TexturePacker'
dir = File.join(ARGV[0], '*plist')
out_dir = File.join(Dir.pwd , ARGV[1])
tmp_dir = "/tmp"
@farmisen
farmisen / main.rb
Created July 8, 2012 03:50
pvr.ccz sprite sheet extractor
require 'rubygems'
require 'json'
require 'chunky_png'
PLUTIL = '/usr/bin/plutil'
TEXTUREPACKER = '/usr/local/bin/TexturePacker'
dir = File.join(ARGV[0], '*plist')
out_dir = File.join(Dir.pwd , ARGV[1])
tmp_dir = "/tmp"
@trongthanh
trongthanh / gist:2779392
Last active March 13, 2026 09:36
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.