Skip to content

Instantly share code, notes, and snippets.

View dr-dimitru's full-sized avatar
👨‍💻
get 💩 done

dr.dimitru dr-dimitru

👨‍💻
get 💩 done
View GitHub Profile
@alkampfergit
alkampfergit / gist:f9fe4f38c85e04f899fe4e4c20f6979a
Last active October 18, 2019 22:03
Drop all mongo databases except the admin and local database
var dbs = db.getMongo().getDBNames()
for(var i in dbs){
db = db.getMongo().getDB( dbs[i] );
if (db.getName() !== 'admin' && db.getName() !== 'local')
{
print( "dropping db " + db.getName() );
db.dropDatabase();
}
}
@jevakallio
jevakallio / reactiveconf-slam-poetry.md
Last active July 7, 2021 19:57
#ReactiveConf 2017 Lightning Talk Submission: JavaScript Slam Poetry

TL;DR: If you want to see me perform a spoken word poem about JavaScript in front of 1000 people (and on video), please ⭐ star this gist. If you're on mobile, you'll need to request desktop site.

JavaScript Slam Poetry

Javascript! Slam! Poetry!

@dr-dimitru
dr-dimitru / mongodb-collections-sizes.js
Last active January 26, 2021 19:21
Show each collection size in MongoDB
var getReadableFileSizeString = function(fileSizeInBytes) {
var i = -1;
var byteUnits = [' kB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
do {
fileSizeInBytes = fileSizeInBytes / 1024;
i++;
} while (fileSizeInBytes > 1024);
return Math.max(fileSizeInBytes, 0.1).toFixed(1) + byteUnits[i];
};
@mralexjuarez
mralexjuarez / Lsyncd Technical Session.md
Last active March 12, 2024 04:09
Quick Tutorial on Using Lsyncd

Lsyncd Technical Session

So what is lsyncd?

Lsyncd is a tool used to keep a source directory in sync with other local or remote directories. It is a solution suited keeping directories in sync by batch processing changes over to the synced directories.

When would we use lsyncd?

So the generic use case is to keep a source directory in sync with one or more local and remote directories.

@fortunto2
fortunto2 / webcheck.sh
Last active July 24, 2016 12:20
Проверка доменов на доступность, срок окончания регистрации домена, логи, свободное место. Работает совместно с панель ispmanager через консольную утилиту mgrctl. Подробнее тут можно посмотреть http://ru.ispdoc.com/index.php/Mgrctl
#!/bin/bash
#проверка сайтов по списку
echo "<<<---------------- www-check ------------------->>>"
SERVERFILE='/tmp/list/all.list'
/usr/local/ispmgr/sbin/mgrctl -m ispmgr wwwdomain | cut -d\ -f1 | cut -d\= -f2 >$SERVERFILE
ADMIN="you@mail.ru"
status_file="/tmp/list/www_status.txt"
@pablote
pablote / install-nginx-rtmp.sh
Last active September 17, 2020 20:06
Install nginx, nginx-rtmp-module and a nodejs app that receives callbacks in a test VM
#!/bin/bash -x
export nginx_version=1.9.9
# get latest rtmp mod
mkdir /usr/local/src
cd /usr/local/src
git clone git://github.com/arut/nginx-rtmp-module.git
# get nginx
wget http://nginx.org/download/nginx-${nginx_version}.tar.gz
@dr-dimitru
dr-dimitru / Meteor_Boilerplate_Structure
Last active August 29, 2015 14:08
Meteor.js boilerplate files and folders structure
myAwesomeApp
|-client
| |-lib #Only Client libraries
| |-js
| |-templates
|-collections #Define, Publish & Subscribe collections
|-lib #Isomorphic (Client + Server) libraries
|-public (or static) #files & folders avaliable via http
| |-css
| |-other
@StefanWallin
StefanWallin / README.md
Last active January 15, 2022 06:22 — forked from konklone/ssl.rules
nginx ssl config with multiple SNI vhosts and A+ SSL Labs score as of 2014-11-05

Configuring nginx for SSL SNI vhosts

Gotchas

Remarks

  • My version of konklones SSL config does not have SPDY support(my nginx+openssl does not support it)
  • You need a default ssl server (example.org-default.conf).
  • Some SSL-options have to be unique across your instance, so it's easier to have them in a common file(ssl.conf).
@dr-dimitru
dr-dimitru / string.js
Last active August 29, 2015 14:07
Clone (a.k.a. create singleton) for String object
/*jshint strict:false */
/*
* @function
* @namespace String.prototype
* @name clone
*
* @description Clone (a.k.a. create singleton) of String object
* This method allows to resolve issue with variable's referencing
* See performance here: http://jsperf.com/clone-create-singleton-for-string-object
@umidjons
umidjons / sort-object-properties-by-value.md
Last active January 16, 2024 13:00
JavaScript: sort object properties by value (numeric or string)

Sort object properties by value (values are text)

I have following object:

var cities={10:'Tashkent', 14:'Karakalpakiya', 16:'Andijan'};

I want sort it by city names, so after sort it should be:

var cities={16:'Andijan', 14:'Karakalpakiya', 10:'Tashkent'};

But I can't sort object properties, instead can convert object into array, then sort items.