This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var inherits = require('inherits'), | |
EventEmitter = require('events').EventEmitter; | |
function BaseController($scope, $http, $location) { | |
if (!(this instanceof BaseController)) { return new BaseController.apply(null, [].slice(arguments)); } | |
$scope.load = this.load; | |
this.$scope = $scope; | |
this.$location = $location; | |
this.$http = $http; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function extend(obj, src) { | |
Object.getOwnPropertyNames(src) | |
.forEach( (propName) => Object.defineProperty(obj, propName, Object.getOwnPropertyDescriptor(src, propName)) ); | |
return obj; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
BACKUP_PATH=/data/backups | |
# IMPORTANT: SET BACKUP PASSWORD, $USER IS A PLACEHOLDER | |
PASSWORD=$(USER) | |
# Add database name, or set to $1 to use command line parameters | |
DATABASE_NAME=$1 | |
BACKUP_TAG="mongodb-"$(DATABASE_NAME)"-"$(date +%F) | |
mongodump -d $(DATABASE_NAME) -o $(BACKUP_PATH)/$(BACKUP_TAG) | |
7z a -r -mx=1 -p$(PASSWORD) $(BACKUP_PATH)/$(BACKUP_TAG).7z $(BACKUP_PATH)/$(BACKUP_TAG)/$(COLLECTION)/*.*son |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
$DETECTED_DOMAIN=$(dnsdomainname) | |
for CID in `docker ps -q`; do | |
IP=$(docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CID) | |
NAME=$(docker inspect --format '{{ .Config.Hostname }}' $CID) | |
echo "$IP $NAME $NAME.$DETECTED_DOMAIN" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(numArray) { | |
var args = [].slice.call(arguments); | |
if ( args.length < 2 ) { throw new Error('Invalid parameters'); } | |
if ( !Array.isArray(numArray) ) { throw new Error('Invalid Input, Must be Array'); } | |
var findSums = args.slice(1, args.length); | |
// unpack sums if array, or use arguments[1:] | |
findSums = Array.isArray(findSums[0]) ? findSums[0] : findSums; | |
return numArray.some(checkSums, findSums); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Save the built CONTAINER (named myapp), stream via ssh | |
docker save myapp | bzip2 | pv | ssh root@vhost2 'bunzip2 | docker load' | |
# Clone a running INSTANCE, stream via ssh | |
docker export web0 | bzip2 | pv | ssh root@vhost2 'bunzip2 | docker import web0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Credit/Reference: http://www.lowendguide.com/3/webservers/http-status-codes-cheat-sheet/ | |
var HTTP_STATUS_DICT = module.exports = { | |
/*## HTTP Successful Codes (2xx)*/ | |
"200": "OK", | |
"201": "Created", | |
"202": "Accepted", | |
"203": "Non-Authoritative Information 1.1", | |
"204": "No Content", | |
"205": "Reset Content", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var API_KEY = '';// <<-- '<__YOUR_KEY__HERE__>'; | |
module.exports = function _geocode(address, callback) { | |
require('request') | |
.get('https://maps.googleapis.com/maps/api/geocode/json?region=us&address=' + encodeURIComponent(address) + '&key=' + encodeURIComponent(API_KEY)) | |
.on('response', function(response) { | |
callback(null, response); | |
}).on('error', function(err) { | |
callback(err); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<link href='http://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'> | |
<link href='https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css' rel='stylesheet' type='text/css'> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js'></script> | |
<script> | |
'use strict' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt-get install -y unhide lsof file sudo | |
sleep 2s | |
cd ~/ | |
wget http://downloads.sourceforge.net/project/rkhunter/rkhunter/1.4.2/rkhunter-1.4.2.tar.gz | |
tar xzvf rkhunter-1.4.2.tar.gz | |
cd rkhunter-1.4.2 | |
sudo ./installer.sh --install | |
rkhunter --update | |
rkhunter --propupd |