Skip to content

Instantly share code, notes, and snippets.

kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@hiephm
hiephm / memuse.md
Last active June 26, 2018 03:17 — forked from Eugeny/memuse.md
memuse - measure a total unique RAM taken by process tree
@hiephm
hiephm / mount_vbox_shared_boot.md
Created May 27, 2018 01:14 — forked from kentwait/mount_vbox_shared_boot.md
Mount VirtualBox shared folder on boot using fstab

How to mount a VirtualBox shared folder when the Guest OS boots

Problem

While using VirtualBox's Guest Additions to mount shared folders provides a seamless way to mount shared folders, there are also disadvantages.

  • Shared folders will always mount in /media/sf_(share name) unless specified using through vbox drivers in the guest OS
  • Mounting does not happen at boot-time. Applications that require paths at boot will not be able to access the shared folder even after it is mounted - such as Docker.

Solution

Instead of relying on Guest Additions, if you have sudo permissions, shared folders can be mounted at boot-time using fstab. Using this approach allows

Principles of Adult Behavior

  1. Be patient. No matter what.
  2. Don’t badmouth: Assign responsibility, not blame. Say nothing of another you wouldn’t say to him.
  3. Never assume the motives of others are, to them, less noble than yours are to you.
  4. Expand your sense of the possible.
  5. Don’t trouble yourself with matters you truly cannot change.
  6. Expect no more of anyone than you can deliver yourself.
  7. Tolerate ambiguity.
  8. Laugh at yourself frequently.
@hiephm
hiephm / bash-cheatsheet.sh
Created September 9, 2016 04:42 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04
@hiephm
hiephm / apt-rdepends-tree
Created September 2, 2016 10:54 — forked from damphat/apt-rdepends-tree
debian dependency tree
#! /bin/bash
# Description: show dependency tree
# Author: damphat
if [ $# != 1 ]; then
echo 'Usage: apt-rdepends-tree <package>'
echo 'Required packages: apt-rdepends'
exit 1
fi
@hiephm
hiephm / gist:ae0a4e401c5490677287ca2fbd9dad7b
Created August 18, 2016 08:24
Debug helper functions
function __die($obj)
{
print_r($obj);die();
}
function __debug($message)
{
$file = __DIR__ . '/../var/log/dump.log';
file_put_contents($file, $message, FILE_APPEND);
file_put_contents($file, "\n", FILE_APPEND);
@hiephm
hiephm / .gitignore
Last active April 20, 2016 07:30
Magento 2 git ignore (NOT for composer installation)
/.idea
/app/etc/env.php
/app/etc/redis.php
/pub/media/*
!/pub/media/.htaccess
/pub/media/catalog/*
!/pub/media/catalog/.htaccess
/pub/media/customer/*
## Magento 2
WEBSERVER_GROUP="www-data"
alias m2="bin/magento"
alias m2rmgen="find var/generation -maxdepth 1 -mindepth 1 -type d -not -name 'Magento' -not -name 'Composer' -not -name 'Symfony' -exec rm -rf {} \;"
alias m2en="m2 module:enable"
alias m2s="m2 module:status"
alias m2f="m2 cache:flush"
alias m2up="sudo find var -type d -exec chmod 775 {} \; && sudo find var -type f -exec chmod 664 {} \; && m2en --all && m2 setup:upgrade && m2rmgen && m2f"
alias m2static="sudo rm -rf var/view_preprocessed/* pub/static/frontend/* pub/static/adminhtml/* pub/static/_requirejs/*"
alias m2fixgroup="sudo usermod -aG $WEBSERVER_GROUP `whoami`"
@hiephm
hiephm / install_magento2_with_db
Created March 29, 2016 03:43 — forked from wsakaren/install_magento2_with_db
Install script for magento2 with database, assumes you are running from www.localhost.com/20
#!/bin/bash
# Sets up a database with a magento2 installation. This assumes you are running from under your httpdocs/20 location and have www.localhost.com in your /etc/hosts file
# To run type : install_magento2 <dirname><password>
# password is used for the datbase user and the magento admin password
if [ $# -eq 0 ]; then
echo "No arguments supplied"
echo "Usage: `basename $0` <dirname><password>"
exit 1
fi