Skip to content

Instantly share code, notes, and snippets.

View vunamhung's full-sized avatar
🎯
Focusing

Hung Vu vunamhung

🎯
Focusing
View GitHub Profile

Install Zsh and Oh-my-zsh on CentOS 7

Based on this article

ALL INSTALLATIONS ASSUME YES WHEN PROMPTED, that's what -y does

This script can be copy paste to ssh as is. No hands installation. :-)

yum install zsh -y
SQL Aggregation Framework
WHERE / HAVING $match
GROUP BY $group
SELECT $project
ORDER BY $sort
LIMIT $limit
sum() / count() $sum
join $lookup
@vunamhung
vunamhung / mongoose.dbref.example.js
Created September 27, 2020 03:34 — forked from hastebrot/mongoose.dbref.example.js
Example of DBRef support in Mongoose 2.0
var mongoose = require("mongoose");
var Schema = mongoose.Schema;
mongoose.connect("127.0.0.1", "mongoose_dbref", 27017);
var PersonSchema = new Schema({
name : String
, age : Number
, stories : [{ type: Schema.ObjectId, ref: 'Story' }]
});
var StorySchema = new Schema({
@vunamhung
vunamhung / scrollToEl.js
Created August 17, 2020 04:17 — forked from benhatsor/scrollToEl.js
Smooth scroll to element - Pure JS
function scrollToEl(el) {
var rect = el.getBoundingClientRect(),
scrollTop = window.pageYOffset || document.documentElement.scrollTop,
scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,
elTop = rect.top + scrollTop,
elLeft = rect.left + scrollLeft;
window.scrollTo({
top: elTop,
left: elLeft,
@vunamhung
vunamhung / clamav-mac.md
Created May 5, 2020 09:09 — forked from Uchean/clamav-mac.md
Get ClamAV running on Mac OS X (using Homebrew)

Get ClamAV running on Mac OS X (using Homebrew)

The easiest way to get the ClamAV package is using Homebrew

$ brew install clamav

Before trying to start the clamd process, you'll need a copy of the ClamAV databases.

Create a freshclam.conf file and configure as so