Skip to content

Instantly share code, notes, and snippets.

View aminsource's full-sized avatar
🎯
Focusing

Hooman Amin aminsource

🎯
Focusing
View GitHub Profile
@aminsource
aminsource / Aggregation
Last active August 20, 2018 12:29
Mongodb
//Aggregation Pipeline
// first match then sort and project name note : _id:0 couse not show _id if not set show _id
db.companies.aggregate([
{ $match : { founded_year : 2011 } },
{ $sort : {name:-1} },
{ $project : { _id : 0, name : 1 } }
])
// query 2
db.companies.aggregate([
{ $match: { founded_year: { $gte: 2010 } } },
d r w x r w x r w x
Owner Group Other
Directory Read Write Execute Read Write Execute Read Write Execute
(R) (W) (X)
0 No No No
1 No No Yes
2 No Yes No
3 No Yes Yes
@aminsource
aminsource / getMethod.py
Created February 11, 2021 07:07
The get() method on Python dicts and its "default" arg
# The get() method on dicts
# and its "default" argument
name_for_userid = {
382: "Alice",
590: "Bob",
951: "Dilbert",
}
def greeting(userid):
@aminsource
aminsource / nginxproxy.md
Created March 6, 2021 06:12 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@aminsource
aminsource / PerformanceTuning_CheatSheet.md
Last active May 23, 2021 03:55 — forked from kzhangkzhang/PerformanceTuning_CheatSheet.md
Oracle SQL Performance Tuning Cheatsheet