Skip to content

Instantly share code, notes, and snippets.

View joshuaebowling's full-sized avatar

Josh Bowling joshuaebowling

View GitHub Profile
@joshuaebowling
joshuaebowling / orientdb-custom-function-with-transaction.js
Created May 2, 2016 21:50
orientdb-custom-function-with-transaction.js
var self = this;
self.db.begin();
self.db.commit();
return 'transaction';
@joshuaebowling
joshuaebowling / user.rules
Created May 3, 2016 18:14
Ubuntu UFW Rules
*filter
:ufw-user-input - [0:0]
:ufw-user-output - [0:0]
:ufw-user-forward - [0:0]
:ufw-before-logging-input - [0:0]
:ufw-before-logging-output - [0:0]
:ufw-before-logging-forward - [0:0]
:ufw-user-logging-input - [0:0]
:ufw-user-logging-output - [0:0]
:ufw-user-logging-forward - [0:0]
@joshuaebowling
joshuaebowling / parse-date-function-body.js
Last active May 4, 2016 19:37
Parse javasscript date to OrientDB date format yyyy-MM-dd HH:mm:ss
/** parameters
//inDate example: Wed, 04 May 2016 19:25:26 GMT
//inMonth example: 4 (which would month number of May if during May you new Date().getMonth())
**/
var strTime, utcDate;
utcDate = inDate.split(' ');
arrTime = utcDate[4].split(':');
@joshuaebowling
joshuaebowling / elasticsearch-2.3.2-install.sh
Created May 18, 2016 14:18
Install elasticsearch 2.3.2 on Ubuntu 14.04 LTS
# prerequisites
# java 8
# get the package
wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-2.3.2.deb
# unpack
sudo dpkg -i elasticsearch-2.3.2.deb
@joshuaebowling
joshuaebowling / do-install-docker.sh
Created April 23, 2017 03:37
digital ocean installing docker
# instructions from https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04
# Add the GPG key for the official Docker repository to the system
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
# Add the Docker repository to APT sources:
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main'
# Update the package database with the Docker packages from the newly added repo:
sudo apt-get update
@joshuaebowling
joshuaebowling / do-ubuntu-16.04-install-nvm-part-1.sh
Last active February 2, 2021 03:25
install nvm on digital ocean ubuntu 16.04
# source https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04
# as of 23/4/2017
#part 1
# add build deps
sudo apt-get update
sudo apt-get -y install build-essential libssl-dev
# grab v0.33.1 (most recent)
@joshuaebowling
joshuaebowling / do-ubuntu-16.04-install-nginx.sh
Created April 24, 2017 02:13
Install Nginx on Digital Ocean Ubuntu 16.04 and configure UFW
# source https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-ubuntu-16-04
sudo apt-get update
sudo apt-get install nginx
# options 'Nginx HTTP', 'Nginx HTTPS', 'Nginx Full'
sudo ufw allow 'Nginx HTTP'
@joshuaebowling
joshuaebowling / wait-for-it-pattern.js
Last active August 2, 2017 20:01
Wait for it... a time-of-no-change based throttling pattern
var
WAIT_TIMER = 1750, // in MS
waitForItTimer,
waitForIt, whatYoureWaitingToInvoke;
whatYoureWaitingToInvoke = function _whatYoureWaitingToInvoke() {
alert(`what you're waiting for!!`);
};
waitForIt = function _waitForIt() {
@joshuaebowling
joshuaebowling / bus-book-generator.js
Last active August 21, 2017 19:36
A prototype for building a JSON object what will act as a message bus's (postal.js) phonebook
const _ = require( 'lodash' ),
async = require( 'async' ),
fs = require('fs')
;
var actions, base, result, states, subActions, template, toObject, types;
result = {};
template = `module.exports = ${JSON.stringify(_.omit(result, 'any'), '', 4)}`;
base = [ '*' ];
<script type="text/template" id="tmpl-cell">
<div class="input mb-2">
<input data-bind="value: character, attr: {id: 'clip-'+name(), 'data-clipboard-target':'#clip-'+name(), title: name()}" type="text" class="form-control box1" placeholder="" aria-label="" aria-describedby="basic-addon1">
</div>
</script>
<script type="text/template" id="tmpl-snippet">
<div>