Skip to content

Instantly share code, notes, and snippets.

View parvez's full-sized avatar
🦊
🚫 Chrome ❤️ Firefox

Parvez parvez

🦊
🚫 Chrome ❤️ Firefox
View GitHub Profile
@parvez
parvez / check_for_new_version.html
Created March 21, 2013 04:58
JavaScript + CSS based Update Check
<script>
var head = document.getElementsByTagName("head")[0];
var css = document.createElement('link');
css.type = 'text/css';
css.rel = 'stylesheet';
css.href = 'http://product.website.here/update_1.0.css?'+Date.now();
// css.href = 'http://product.website.here/update_1.2.css?'+Date.now(); Uncomment for version 1.2
css.media = 'screen';
head.appendChild(css)
</script>
== Rules ==
On Infrastructure
-----------------
There is one system, not a collection of systems.
The desired state of the system should be a known quantity.
The "known quantity" must be machine parseable.
The actual state of the system must self-correct to the desired state.
The only authoritative source for the actual state of the system is the system.
The entire system must be deployable using source media and text files.

Keybase proof

I hereby claim:

  • I am parvez on github.
  • I am parvez (https://keybase.io/parvez) on keybase.
  • I have a public key whose fingerprint is 1E0D 8EEB 4C89 6D7E 22A8 DB4A 2434 6FE8 49D6 4BD8

To claim this, I am signing this object:

--- init.d-mongod
+++ patched.init.d-mongod
@@ -11,22 +11,26 @@
# NOTE: if you change any OPTIONS here, you get what you pay for:
# this script assumes all options are in the config file.
-CONFIGFILE="/etc/mongod.conf"
-OPTIONS=" -f $CONFIGFILE"
+CONFIGFILE_AUTH="/etc/mongodb/auth.conf"
+CONFIGFILE_NOAUTH="/etc/mongodb/noauth.conf"
# security Options
security:
authorization: enabled
db.dropAllUsers()
db.createUser( { user: "root", pwd: "SECRET_PASSWORD", roles: [ "root", "userAdminAnyDatabase", "dbOwner" ] } )
db.dropAllUsers()
db.createUser( { user: "app_admin", pwd: "SECRET_PASSWORD", roles: [ { role: "userAdmin", db: "my_app" }, { role: "dbAdmin", db: "my_app" }, { role: "dbOwner", db: "my_app" } ] } )
db.createUser( { user: "app_reporting", pwd: "SECRET_PASSWORD", roles: [ { role: "read", db: "my_app" } ] } )

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@parvez
parvez / sniff.js
Created October 30, 2017 22:25
Sniff NodeJS
app.use((req, res, next) => {
try {
var sniff_data = {}
sniff_data.host = req.headers && req.headers.host
sniff_data.url = req.url
sniff_data.method = req.method
sniff_data.user_agent = req.headers && req.headers['user-agent']
sniff_data.ip_address = {}
if (req.connection && req.connection.socket && req.connection.socket.remoteAddress) {
You can try netstat
netstat -vanp tcp | grep 3000
For macOS El Capitan and newer (or if your netstat doesn't support -p), use lsof
sudo lsof -i tcp:3000