Skip to content

Instantly share code, notes, and snippets.

View joseabraham's full-sized avatar
😎
Building cool things

Jose Abraham Garcia joseabraham

😎
Building cool things
View GitHub Profile
@sahilsk
sahilsk / ELK Procedure
Created August 26, 2014 04:53
nginx proxy configuration for elasticsearch
## 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"
@wdullaer
wdullaer / install.sh
Last active April 3, 2025 19:08
Install Latest Docker and Docker-compose on Ubuntu
# 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"
@nhagen
nhagen / PromisAllWithFails.js
Last active November 15, 2022 18:11
Wait until all promises have completed even when some reject, with Promise.all
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);
})
@EvgenyOrekhov
EvgenyOrekhov / A simple Docker and Docker Compose install script for Ubuntu.md
Last active February 8, 2025 23:28
A simple Docker and Docker Compose install script for Ubuntu

A simple Docker and Docker Compose install script for Ubuntu

Usage

  1. sh install-docker.sh
  2. log out
  3. log back in

Links

@craigvantonder
craigvantonder / setup-awscli-codedeploy-agent.sh
Last active February 11, 2021 12:15
How to install AWS Code Deploy agent in Ubuntu 14.04 / 16.04 / 18.04 / 20.04
#!/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
@ruanbekker
ruanbekker / cheatsheet-elasticsearch.md
Last active March 31, 2025 14:50
Elasticsearch Cheatsheet : Example API usage of using Elasticsearch with curl
@marilynwaldman
marilynwaldman / Jenkins On GCP Kubernetes
Created December 3, 2017 22:41
Instructions for setting up Jenkins on Kubernetes - tested
Continuous deployment with Jenkins
Connection Details
Open Google Console
Username
Password
GCP Project ID
Continuous Deployment with Jenkins
@srquinn21
srquinn21 / README.markdown
Last active August 28, 2020 02:04
Cross Site WebSocket Hijacking Nginx Config

Notes

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)

@jrrio
jrrio / reduce_Object.md
Created April 23, 2018 15:06
Calculate the average of Object properties using for...in loop, Object.keys(), Object.values(), and Object.entries()

Calculate the average of Object properties

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 }
};