Skip to content

Instantly share code, notes, and snippets.

NOTE -

  • Remove -h option if you are doing operation on same machine
  • Remove -u , -p option if your database don't have username and password

Binary

Import database

mongorestore -h IP:port -d DB_Name -u user_name -p password <input db directory>
#!/bin/sh
# usage: ngx-package-tool [install | list-modules | enable-modules | cleanup-debug] [OPTIONS]
# by @allex_wang
# shellcheck disable=SC2196,SC2086
#
# GistID: 355a1d7c6fa1f89844c1dd776fd63a16
# GistURL: https://gist.github.com/355a1d7c6fa1f89844c1dd776fd63a16
PROG=$(basename "$0")
@allex
allex / curl-api
Last active February 13, 2023 08:58
#!/bin/bash
# vim: set ft=sh fdm=marker ts=2 sw=2 sts=2 tw=85 et:
set -euEo pipefail
# ================================================
# Description: #{$Description}
#
# Usage:
# curl-api [-h, --json <JSON>, --parse-token <TOKEN_NAME>]
#
@allex
allex / Dockerfile
Created January 12, 2022 14:47 — forked from shov/Dockerfile
Docker PHP 7.2 fpm with GD jpg, png suppot
FROM php:7.2-fpm
# Replace shell with bash so we can source files
RUN rm /bin/sh && ln -s /bin/bash /bin/sh
# make sure apt is up to date
RUN apt-get update --fix-missing
RUN apt-get install -y curl
RUN apt-get install -y build-essential libssl-dev zlib1g-dev libpng-dev libjpeg-dev libfreetype6-dev
#!/usr/bin/env awk -f
# Parse option args with an OPTSTRING
#
# Author: Allex Wang ([email protected])
# Last Modified: Tue Aug 24, 2021 20:08
#
# Usage: echo "<OPTS>|<ARGS>" | parse_args
# eg> echo "-c 10 --welcome 'hi allex' -f |-c:,-v,--welcome:" | awk -f parse_args.awk
#
#!/bin/bash
# vim: set ft=sh fdm=marker ts=2 sw=2 sts=2 tw=85 et:
set -eu
# ================================================
# Description: Enhanced docker build with some helper parameters, such as --env, --build-arg-file
#
# Usage:
# docker-build [ -t tag_list ] [ -f Dockerfile ] [ ... ] [ --env <env_file> ] [ --build-arg-file <args_file> ]
#
#!/bin/bash
# By allex_wang
# GistID: 3bed8534d89fa58ff47b9d98752e3fef
# Last Modified: Fri Sep 24, 2021 10:51
set -e
PROG=$(basename "$0")
error() { echo >&2 "[$PROG]: ${*}"; }
[ "${CI-}" != true ] && { error "Runner context invalid"; exit 1; }
[ "${CI_DEBUG_TRACE-}" = "true" ] && set -x
@allex
allex / pack.js
Last active August 4, 2021 11:26
#!/usr/bin/env node
// GistID: 5ca7aa7bae0dc160c2e651611cc801ad
// GistURL: https://gist.github.com/allex/5ca7aa7bae0dc160c2e651611cc801ad
// by allex | MIT Licensed
// Usage: pack.js /foo/path -o - |tar tzf -
const sh = (cmd) => require('child_process').execSync(cmd).toString().trim()
const npmRoot = sh('npm root -g')
require('app-module-path').addPath(`${npmRoot}/npm/node_modules`)
@allex
allex / kubernetes-dashboard.md
Created August 2, 2021 15:08 — forked from tonysneed/kubernetes-dashboard.md
Kubernetes Dashboard
  1. Install the dashboard
    • Run: kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.2.0/aio/deploy/recommended.yaml
  2. Create admin-user
    • Create a file named: dashboard-adminuser.yaml
    • Add this content:
apiVersion: v1
kind: ServiceAccount
metadata:
@allex
allex / input.scss
Created July 21, 2021 14:13
Generated by SassMeister.com.
// colors
$color-black: #595a5d !default;
$color-white: #fff !default;
$color-primary: #566779 !default;
$color-success: #40e193 !default;
$color-warning: #ffc688 !default;
$color-danger: #f44747 !default;
$color-info: #909399 !default;
$color-highlight: #edc547 !default;