Skip to content

Instantly share code, notes, and snippets.

View dungdm93's full-sized avatar
🏁
Working hard

Đặng Minh Dũng dungdm93

🏁
Working hard
  • VPBank
  • Hanoi, Vietnam
  • Facebook dungdm93
View GitHub Profile
@dungdm93
dungdm93 / bash-color.sh
Created October 23, 2018 04:16
Colorize terminal
#!/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 / 0-README.md
Last active July 7, 2019 04:10
Django serve staticfiles

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 / semver-regex.md
Last active September 23, 2019 07:25
SemVer regex

Canonical regex

/^
(?'MAJOR'
    0|(?:[1-9]\d*)
)
\.
(?'MINOR'
 0|(?:[1-9]\d*)
@dungdm93
dungdm93 / gradle.md
Last active May 4, 2020 05:54
maven commands
plugins {
  id "com.dorongold.task-tree" version "1.5"
}

task resolveDependencies {
    setDescription "Resolves all projects dependencies from the repository."
    setGroup "Build Server"

 doLast {
@dungdm93
dungdm93 / README.md
Last active February 11, 2020 02:40
faster import nyc-taxi-data

PostgreSQL

Monitoring Progress of Index Construction

PostgreSQL 12+

SELECT 
  now()::TIME(0), 
  a.query, 
  p.phase, 
  p.blocks_total, 
  p.blocks_done, 
-- Show all databases
SELECT
database_id,
name,
create_date
FROM sys.databases;
--or using Stored Procedure
EXEC sp_databases;
-- Switch database

tar

# extract
tar -xvf archive.tar

# List files in archive.tar
tar -tvf archive.tar

# compress
tar -cvf archive.tar foo bar
{
"exp": 1612718555,
"iat": 1612718255,
"auth_time": 1612717668,
"jti": "1546abd9-68c8-4167-a094-05bc09ca4811",
"iss": "https://keycloak.dungdm93.me/auth/realms/data",
"aud": [
"realm-management",
"account"
],
@dungdm93
dungdm93 / README.md
Last active September 15, 2021 15:16
Kafka
kafkacat -b bootstrap.kafka.host:9092 \
  -C -t topic \
  -s avro -r http://schema-registry.host:8081 \
  -f '
  Key (%K bytes): %k
  Value (%S bytes): %s
  Timestamp: %T
  Partition: %p
 Offset: %o
@dungdm93
dungdm93 / starship.toml
Created November 19, 2021 10:40
starship config
format = """
$username\
$hostname\
$directory\
$git_branch\
$git_commit\
$git_status\
$git_state\
$kubernetes\
$golang\