Skip to content

Instantly share code, notes, and snippets.

View glee2017's full-sized avatar

glee2017 glee2017

View GitHub Profile
cd tomcat/lib
java -cp catalina.jar org.apache.catalina.util.ServerInfo
# vagrant host will be assigned public IP
config.vm.network "public_network"
# private network, test locally as localhost only
config.vm.network "private_network", ip: "192.168.5.3"
# forwarding, can use localhost and host ip address
config.vm.network "forwarded_port", guest: 443, host: 5443
config.vm.network "forwarded_port", guest: 8443, host: 9443
config.vm.network "forwarded_port", guest: 22, host: 2200
vagrant plugin list
638 vagrant plugin uninstall
639 vagrant plugin uninstall vagrant-vbguest
640 vagrant plugin list
641 vagrant reload
@glee2017
glee2017 / gist:92a56c5d7efddda149c68eb7e97ea75e
Created March 27, 2019 14:38
GIT remove directory and commit history
git clone git@rcode.rockefeller.edu:webdev/Kiosks.git
cd Kiosks/
rm -rf ./test
git rm test/*
git commit -m "removed test directory"
git push origin master
git filter-branch --tree-filter 'rm -rf test' --prune-empty HEAD
git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d
echo test/ >> .gitignore
@glee2017
glee2017 / gist:81e1ce55a8a27ca328c60edcde38c52d
Created February 1, 2019 18:50
AuthFailure => AWS was not able to validate the provided access credentials (Vagrant)
sudo apt-get update
sudo apt install ntpdate
sudo ntpdate ntp.ubuntu.com
sudo ntpdate time.nist.gov |0.amazon.pool.ntp.org
// pass from file
var request = require('request');
var fs = require('fs');
var config = require('./config');
const loadJsonFile = require('load-json-file');
let obj = loadJsonFile.sync('./names.json');
request.patch({
@glee2017
glee2017 / sortexample.js
Created October 9, 2018 21:29
Javascript sort associative array of object by a key field
var emails = [
{ id : 0, email: "xil@test.com", lname: "Kelly", lname: "Jim" },
{ id : 1, email: "abc@test.com", lname: "Xu", lname: "Dave" },
{ id : 2, email: "fill@test.com", lname: "Cato", lname: "Harry" },
];
// print not sorted
for (i=0; i < emails.length; i++) {
console.log(emails[i].email+', '+emails[i].lname+', '+ emails[i].fname);
#Vagrant was unable to mount VirtualBox shared folders. This is usually because the filesystem "vboxsf" is not available. This filesystem is made available via the VirtualBox Guest Additions and kernel module.
#vagrant plugin install vagrant-vbguest
#vagrant reload
@glee2017
glee2017 / commasplit.js
Created May 21, 2018 15:16
JS: split string with comma into array
if (string.indexOf(',') > -1) {
array = string.split(',')
}
curl localhost:9200/_nodes/stats?pretty|grep -A 10 "jvm"
curl localhost:9200/_cluster/health?pretty
curl -X GET http://localhost:9200/_cat/indices
curl 'http://localhost:9200/_cat/nodes?v'