Skip to content

Instantly share code, notes, and snippets.

View anhphamt's full-sized avatar

Phamazing anhphamt

View GitHub Profile
# If the commands fail on Windows, then make sure you're running in GitBash/Cygwin and NOT cmd
# HELP!
docker --help
# List docker images
docker images
# List running containers
docker ps
@anhphamt
anhphamt / guide.md
Last active January 14, 2021 01:02
Ajax post to download file as BLOB content
$.ajax({
    type: "POST",
    url: _url,
    xhrFields: {
        responseType: "blob" // to avoid binary data being mangled on charset conversion
    },
    success: function(blob, status, xhr) {
        // check for a filename
        var filename = "";
@anhphamt
anhphamt / docker-command.md
Last active December 24, 2020 01:02
Top useful docker commands

Top 16 docker commands

To remove all images which are not used by existing containers

docker image prune -a

List running containers.

docker ps  
@anhphamt
anhphamt / sidekiq.service
Created May 13, 2020 10:32 — forked from reabiliti/sidekiq.service
Sidekiq service auto start for Ubuntu 18.04 using Systemd
#
# Sidekiq auto start using systemd unit file for Ubuntu 18.04
#
# Put this in /lib/systemd/system (Ubuntu).
# Run:
# 1. systemctl enable sidekiq (to enable sidekiq service)
# 2. systemctl {start,stop,restart} sidekiq (to start sidekiq service)
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
#!/usr/bin/env bash
#
# Originally from https://gist.github.com/IanVaughan/2902499
#
# authors: Ian Vaughan
# Jacob Zimmerman
#
# usage: uninstall_gems [<version> ...]
#
# examples:
@anhphamt
anhphamt / iterm2.md
Created October 9, 2019 03:47 — forked from squarism/iterm2.md
iterm2 cheatsheet

Tabs and Windows

Function Shortcut
New Tab + T
Close Tab or Window + W (same as many mac apps)
Go to Tab + Number Key (ie: ⌘2 is 2nd tab)
Go to Split Pane by Direction + Option + Arrow Key
Cycle iTerm Windows + backtick (true of all mac apps and works with desktops/mission control)
@anhphamt
anhphamt / jenkins-issue.md
Last active November 8, 2019 08:02
Jenkins admin permission read/write issue
@anhphamt
anhphamt / default.vcl_PREFACE.md
Created April 3, 2019 06:43 — forked from fevangelou/default.vcl_PREFACE.md
The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

The perfect Varnish configuration for Joomla, WordPress & other CMS based websites

IMPORTANT: Read this before implementing one of the configuration files below (for either Varnish 3.x or 4.x+).

USE: Replace the contents of the main Varnish configuration file located in /etc/varnish/default.vcl (root server access required - obviously) with the contents of the configuration you'll use (depending on your Varnish version) from the 2 examples provided below.

IMPORTANT: The following setup assumes a 3 minute (180 sec) cache time. You can safely increase this to 5 mins for less busier sites or drop it to 1 min or even 30s for high traffic sites.

This configuration requires an HTTP Header and a user cookie to identify if a user is logged in a site, in order to bypass caching overall (see how it's done in the Joomla section). If your CMS provides a way to add these 2 requirements, then you can use this configuration to speed up your site or entire server. You can even exclude the domains you don't want to cach

@anhphamt
anhphamt / my.cnf
Created March 26, 2019 12:08 — forked from fevangelou/my.cnf
Optimized my.cnf configuration for MySQL/MariaSQL (on Ubuntu, CentOS etc. servers)
# Optimized my.cnf configuration for MySQL/MariaSQL
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# === Updated December 2018 ===
#
# The settings provided below are a starting point for a 2GB - 4GB RAM server with 2-4 CPU cores.
# If you have less or more resources available you should adjust accordingly to save CPU,
# RAM and disk I/O usage.
# The settings marked with a specific comment or the word "UPD" after the value
@anhphamt
anhphamt / nginx.conf
Created November 25, 2018 14:41 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048