Skip to content

Instantly share code, notes, and snippets.

🏁
Working hard

Đặng Minh Dũng dungdm93

🏁
Working hard
Block or report user

Report or block dungdm93

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View circleci.yml
version: 2
jobs:
test:
docker:
- image: python:3.6-stretch
- image: tekodocker12/elasticsearch:7.1.1-icu
environment:
MYSQL_ROOT_PASSWORD: S3cret
steps:
@dungdm93
dungdm93 / flask-metrics.py
Created Oct 9, 2019
Prometheus apps monitoring
View flask-metrics.py
def register_telemetry(flask_app):
from prometheus_client import multiprocess
from prometheus_client.core import CollectorRegistry
from prometheus_flask_exporter import PrometheusMetrics
registry = CollectorRegistry()
multiprocess.MultiProcessCollector(registry, path=os.environ.get('prometheus_multiproc_dir', '/tmp'))
return PrometheusMetrics(
flask_app, group_by='url_rule', registry=registry,
static_labels={
View docker-compose.yml
version: '3.7'
services:
prometheus:
image: prom/prometheus:v2.12.0
network_mode: host
volumes:
- ./prometheus.yml:/etc/prometheus/prometheus.yml
grafana:
View semver-regex.md

Canonical regex

/^
(?'MAJOR'
    0|(?:[1-9]\d*)
)
\.
(?'MINOR'
    0|(?:[1-9]\d*)
@dungdm93
dungdm93 / android-gradle.yml
Last active Aug 10, 2019
GitLab-CI: Caching by package manager
View android-gradle.yml
variables:
ANDROID_COMPILE_SDK: "28"
test:unit:
image: circleci/android:api-${ANDROID_COMPILE_SDK}
cache:
key: gradle-cache
paths: [ .gradle ]
variables:
# GRADLE_OPTS: "-Dorg.gradle.daemon=false"
View test.sh
count=1
while true; do
echo $((count++));
kubectl get pod -A > /dev/null;
sleep 1;
done;
@dungdm93
dungdm93 / 0-README.md
Last active Jul 7, 2019
Django serve staticfiles
View 0-README.md

Django Staticfiles

Django staticfiles is the most common problem you need to solve before putting your app on the production. In this tutorial, I and you will walk through the solution options, included.

  • runserver: Only in development environment.
  • gunicorn: Use gunicorn as your app server.
  • nginx: Put nginx web server in a front of your app server (gunicorn).
  • whitenoise: Let your django app self-serve static files.
@dungdm93
dungdm93 / gitlab.rb
Last active May 14, 2019
Gitlab OAuth2 with Google
View gitlab.rb
### OmniAuth Settings
###! Docs: https://docs.gitlab.com/ce/integration/omniauth.html
gitlab_rails['omniauth_enabled'] = true # Show "Signin with..." button in Login page
gitlab_rails['omniauth_allow_single_sign_on'] = ['google_oauth2'] # Create account automatically
# gitlab_rails['omniauth_sync_email_from_provider'] = 'saml'
gitlab_rails['omniauth_auto_sign_in_with_provider'] = 'google_oauth2' # Redirect to provider login page when enter gitlab login page
# gitlab_rails['omniauth_block_auto_created_users'] = true # true: auto-created user must be admin approved
# gitlab_rails['omniauth_auto_link_ldap_user'] = false
# gitlab_rails['omniauth_auto_link_saml_user'] = false
# gitlab_rails['omniauth_external_providers'] = ['twitter', 'google_oauth2']
View .bashrc
alias ..='cd ..'
if [[ ! "$PATH" =~ (^|:)"$HOME/.local/bin"(:|$) ]]; then
export PATH="$HOME/.local/bin:$PATH"
fi
export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh"
export NVM_DIR="$HOME/.nvm"
@dungdm93
dungdm93 / bash-color.sh
Created Oct 23, 2018
Colorize terminal
View bash-color.sh
#!/bin/bash
##### Color table #####
# Black 0;30 Dark Gray 1;30
# Red 0;31 Light Red 1;31
# Green 0;32 Light Green 1;32
# Brown/Orange 0;33 Yellow 1;33
# Blue 0;34 Light Blue 1;34
# Purple 0;35 Light Purple 1;35
# Cyan 0;36 Light Cyan 1;36
You can’t perform that action at this time.