Skip to content

Instantly share code, notes, and snippets.

View dungdt88's full-sized avatar

Richard Dam dungdt88

  • Ho Chi Minh City, Vietnam
View GitHub Profile
@dungdt88
dungdt88 / nginx_handle_proxy_down.md
Created September 29, 2017 09:46
Nginx - Handle Response when Proxy is down

When the proxied service is unavailable, Nginx will by default return HTTP code 502. We can change this response by the following config:

server {
  location {
      proxy_pass http://somehost/someuri
  }
  ...
@dungdt88
dungdt88 / .vimrc
Created April 15, 2018 04:10
Sample .vimrc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Maintainer:
" Amir Salihefendic
" http://amix.dk - [email protected]
"
" Version:
" 5.0 - 29/05/12 15:43:36
"
" Blog_post:
" http://amix.dk/blog/post/19691#The-ultimate-Vim-configuration-on-Github
@dungdt88
dungdt88 / tmux_example.md
Created July 6, 2018 05:05
Tmux to share bash session

Create a new session

tmux new -s <session-name>

List all current session

tmux ls
@dungdt88
dungdt88 / Hugo_CLI.md
Created September 1, 2018 07:01
Hugo Commands

Export to static HTML:

hugo -s [/path/to/source] -d [/path/to/destination] -b [/base/url]
@dungdt88
dungdt88 / bq-cheat-sheet.md
Created March 12, 2019 07:47
BigQuery Cheat Sheet

Copy a partition

bq cp -f [PROJECT]:[DATASET].[SOURCE_TABLE]\$[SOURCE_PARTITION] [PROJECT]:[DATASET].[DESTINATION_TABLE]\$[DESTINATION_PARTITION]

Postgres Cheat Sheet

List all tables

\dt

List tables together with their sizes:

@dungdt88
dungdt88 / tmux-cheatsheet.markdown
Created August 14, 2019 12:03 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dungdt88
dungdt88 / k8s-cheatsheets.md
Last active February 7, 2025 10:26
Kubernetes Cheetsheets

Kubernetes Cheetsheets

Check Pod memory/CPU usage

k exec -it <pod-name> -- cat /sys/fs/cgroup/memory/memory.usage_in_bytes
k exec -it <pod-name> -- cat /sys/fs/cgroup/cpu/cpuacct.usage

Source: https://www.toptal.com/python/tips-and-practices

This resource contains a collection of Python best practices and Python tips provided by our Toptal network members. As such, this page will be updated on a regular basis to include additional information and cover emerging Python techniques. This is a community driven project, so you are encouraged to contribute as well, and we are counting on your feedback.

Python is a high level language used in many development areas, like web development (Django, Flask), data analysis (SciPy, scikit-learn), desktop UI (wxWidgets, PyQt) and system administration (Ansible, OpenStack). The main advantage of Python is development speed. Python comes with rich standard library, a lot of 3rd party libraries and clean syntax. All this allows a developer to focus on the problem they want to solve, and not on the language details or reinventing the wheel.

Check out the Toptal resource pages for additional information on Python. There is a Python hiring guide, Python job

mongodump

Dump a single collection

mongodump -h "mongodb0.example.com:27017" -d dbname -u user -p password -c collectionname -o path-to-output

Make a backup (dump all collections)

mongodump -h "mongodb0.example.com:27017" -d dbname -u user -p password -o path-to-backup