Skip to content

Instantly share code, notes, and snippets.

How to get MongoDB statistics for all collections?

Useful script to find out MongoDB collections size and other statistics.

Studio 3T > IntelliShell

var dbs = db.getMongo().getDBNames();

for (adb of dbs) {

How to disable page caching with create-react-app

If you currently not using a service worker resulting in old production caches being used and users not getting new versions of the app.

src/index.js

Use:

import { unregister as unregisterServiceWorker } from './registerServiceWorker'
/**
* Zbruc.eu style improvements (2017-09-01)
*
*/
*, .views-field-title .views-field-title, .views-field-field-avtor-haliciana *, .views-field-field-author *, .views-field-field-author {
font-family: sans-serif;
line-height: 1.6em;
}
@liberborn
liberborn / postgres-cheatsheet.md
Created August 12, 2017 13:20 — forked from Kartones/postgres-cheatsheet.md
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@liberborn
liberborn / find_and_remove.js
Created May 18, 2017 09:49 — forked from max-frai/find_and_remove.js
Find and remove inactive facebook friends & bots
var accountTag = 'own_remove_account_tag';
var css = " \
.own_popup { \
width: 50%; min-width: 676px; height: 80%; padding: 15px; \
background: white; border: 1px solid #eee; border-radius: 15px; \
z-index: 999999; position: fixed; margin: auto; \
top: 50px; left: 0; right: 0; \
-webkit-box-shadow: 0px 3px 38px 0px rgba(50, 50, 50, 0.32); \
-moz-box-shadow: 0px 3px 38px 0px rgba(50, 50, 50, 0.32); \
box-shadow: 0px 3px 38px 0px rgba(50, 50, 50, 0.32); \
@liberborn
liberborn / remove.js
Created May 18, 2017 09:48 — forked from max-frai/remove.js
Remove outgoing facebook friend requests
var interval = window.setInterval(function() {
var moreButton = document.querySelector('a[ajaxify*="outgoing/more"]');
if (moreButton)
{
moreButton.click();
console.log('loading more...');
}
else
{
//window.clearInterval(interval);
@liberborn
liberborn / Multiple PHP under Ubuntu 13.04.md
Created June 27, 2016 22:22 — forked from gmodarelli/Multiple PHP under Ubuntu 13.04.md
How to setup Ubuntu 13.04 to work with multiple PHP version at the same time

Multiple PHP version under Ubuntu 13.04

Update your machine

apt-get update
apt-get ugrade

Install some dependencies

apt-get install build-essential