Skip to content

Instantly share code, notes, and snippets.

View alexandrusavin's full-sized avatar
🤞
Coding

Alexandru Savin alexandrusavin

🤞
Coding
View GitHub Profile
@alexandrusavin
alexandrusavin / glassfishWrapper.sh
Created January 29, 2014 16:36
Wrapper script for starting/stopping Glassfish3 application with supervisord
#!/bin/bash
pidfile=/path/to/the/pidfile
function stopDomain {
echo "Sutting down domain."
/path/to/bin/asadmin stop-domain name
}
function startDomain {
@alexandrusavin
alexandrusavin / deleteFiles.php
Created January 29, 2014 16:27
Script to delete lot's of files without a big impact on the system IO
<?php
// path where the files should be deleted
define('PATH', '/.');
// delete only files older than OLDER_THAN_DAYS days
define('OLDER_THAN_DAYS', 14);
// delete only files that match MATCH_NAME
define('MATCH_NAME', '/some regexp/i');
// do NOT actually delete the files
define('DRYRUN', false);
// sleep SLEEP_USEC microsecconds after each delete
@alexandrusavin
alexandrusavin / AbstractEventsDispatcher.js
Last active December 26, 2015 02:49
Simplified event dispatcher for in browser javascript.
/**
* Ex:
*
* Object = function () {}
* Object.prototype = new AbstractEventsDispatcher;
*
* Object.trigger("event", arguments);
*/
var AbstractEventsDispatcher = function () {