## Install Docker | |
``` | |
# install the backported kernel | |
$ sudo apt-get update | |
$ sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring | |
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
$ sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
# Ask for the user password | |
# Script only works if sudo caches the password for a few minutes | |
sudo true | |
# Install kernel extra's to enable docker aufs support | |
# sudo apt-get -y install linux-image-extra-$(uname -r) | |
# Add Docker PPA and install latest version | |
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list" |
var a = ["sdfdf", "http://oooooolol"], | |
handleNetErr = function(e) { return e }; | |
Promise.all(fetch('sdfdsf').catch(handleNetErr), fetch('http://invalidurl').catch(handleNetErr)) | |
.then(function(sdf, invalid) { | |
console.log(sdf, invalid) // [Response, TypeError] | |
}) | |
.catch(function(err) { | |
console.log(err); | |
}) |
#!/bin/bash | |
# AWS CLI | |
apt-get install zip -y; | |
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"; | |
unzip awscli-bundle.zip; | |
./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws; | |
aws configure; | |
#AWS Access Key ID [None]: Obtained when creating user in AWS IAM |
My Elasticsearch cheatsheet with example usage via rest api (still a work-in-progress)
Continuous deployment with Jenkins | |
Connection Details | |
Open Google Console | |
Username | |
Password | |
GCP Project ID | |
Continuous Deployment with Jenkins |
While researching possible Websocket vulnerabilities, I came across the "Cross Site WebSocket Hijacking" attack as documented here:
http://www.christian-schneider.net/CrossSiteWebSocketHijacking.html
https://www.notsosecure.com/how-cross-site-websocket-hijacking-could-lead-to-full-session-compromise/
TL;DR: Websockets, by spec, do not respect the browser's Same Origin Policy enforced for CORs and XHR requests. This means that a connection made in one browser tab can be hijacked in another browser tab similar to a typical XSS attack. In order to protect our services, we need to make sure that the Origin header matches the application's server name.
I've provided a nginx.conf file below that demonstrates how to check the Origin header. In addition to this config update, you'll also want to be sure to use a session token during your websocket handshake that is verified on the server for each connection. I suggest looking into JSON Web Tokens (JWT)
Here is our Object literal with some properties. What we need to do is calculate the average height of a set of people using JavaScript.
const data = {
"Matt": { "height" : 176, "weight": 87 },
"Jason": { "height" : 190, "weight": 103 },
"Peter": { "height" : 180, "weight": 98 }
};