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 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 / 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
@dungdm93
dungdm93 / jinja-cli.py
Last active Oct 18, 2018
Render Jinja template
View jinja-cli.py
import jinja2
loader = jinja2.FileSystemLoader(searchpath="./")
env = jinja2.Environment(loader=loader)
TEMPLATE_FILE = "template.j2"
template = env.get_template(TEMPLATE_FILE)
output = template.render()
print(f"[{output}]")
@dungdm93
dungdm93 / paas-gae.yml
Last active Dec 10, 2017
GitLab-CI: Deploy Scripts
View paas-gae.yml
deploy:paas-gae:
stage: deploy
image: google/cloud-sdk
before_script:
- echo "${GCLOUD_SERVICE_KEY}" > /tmp/.gsa.key
- gcloud auth activate-service-account --key-file /tmp/.gsa.key
- gcloud config set project "${PROJECT_NAME}" # TODO: change this
script:
- gcloud app deploy
environment:
@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 .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 / 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 web-fragment.xml
<web-fragment version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-fragment_3_0.xsd">
</web-fragment>
@dungdm93
dungdm93 / serializable.rb
Created Mar 19, 2016
Serializable Attribute
View serializable.rb
module Serializable
extend ActiveSupport::Concern
module ClassMethods
def dump(obj)
return if obj.nil?
assert_valid_value obj
ActiveSupport::JSON.encode obj
end
You can’t perform that action at this time.